Hibernate 3 - erro ao recuperar dados

4 respostas
D

E ae galera … blz

Estou usando o Hibernate 3 com anotações + SQL server

meu problema é o seguinte, quando tenho um campo int no BD

e o valor dele é NULL dá erro no hibernate ao tentar recuperar

– IllegalArgumentException –

o banco já existe … e já contém dados

alguma ideia?

4 Respostas

W

show me the code

D
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
	at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
	at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
	at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:66)
	... 35 more
Caused by: java.lang.IllegalArgumentException: Can not set int field com..model.VisitaRealizada.flagVisitaRealizada to null value
	at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
	at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
	at sun.reflect.UnsafeIntegerFieldAccessorImpl.set(Unknown Source)
	at java.lang.reflect.Field.set(Unknown Source)
	at org.hibernate.property.DirectPropertyAccessor$DirectSetter.set(DirectPropertyAccessor.java:79)
	... 51 more
W

use Integer ou Long ao invés de int ou long, o efeito é o mesmo e permite null

D

verdade … objetos permitem null

valeu

Criado 26 de abril de 2007
Ultima resposta 26 de abr. de 2007
Respostas 4
Participantes 2