Problema hibernate

2 respostas
M
Olá, a todos!!Estou tentando fazer uma consulta, para que os dados sejem inseridos na tabela está assim: ClienteDao
public List lista() {
	ry{
	           lista= HibUtil.getSession().createQuery("from Cliente order  by nome").list();	
			 
	}catch( HibernateException ex){ex.printStackTrace();}
	return lista;
}
Populando jtable:
while(it.hasNext()){
	Cliente cliente = (Cliente) it.next();
	dtm.addRow(new Object[]{new JRadioButton (cliente.getId().toString()), cliente.getNome(), new RemMask().addCpf(cliente.getCpf()), new RemMask().addTel(cliente.getTelefone()), new RemMask().addTel(cliente.getCelular())});
No entando, a classe cliente, ela faz relacionamento com a classe cidade. Não sei se é por isso, mas retorna este erro:
org.hibernate.PropertyAccessException: Exception occurred inside setter of svl.pojos.Cliente.cidade
	at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:65)
//*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*

Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)

2 Respostas

_fs

Você faz algum processamento no Cliente.setCidade?

M

Oh Lipe!!Faço sim!!Cliente mora em uam cidade, e numa cidade tem varios cliente!!

Criado 24 de junho de 2007
Ultima resposta 25 de jun. de 2007
Respostas 2
Participantes 2