Joined: Thu Jun 03, 2004 10:29 am Posts: 13
|
While using version 2.1.3
I have a POJO that has an int property with the proper setters and getters:
int riskScore
The field in the DB is nullable so I mapped it as such:
<property name="riskScore" column="risk_score" not-null="false" update="false" type="java.lang.Integer"/>
I tried to get more information by making this setting in hibernate.cfg.xml:
<property name="hibernate.cglib.use_reflection_optimizer">false</property>
When I do all of this I get an exception:
net.sf.hibernate.PropertyAccessException: exception setting property value with
CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter
of com.tracfone.max.Alarm.setRiskScore
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(
AbstractEntityPersister.java:212)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2
199)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:240)
etc....
If I change the property type to Integer in the POJO, everything works out correctly. But I don't want to adjust all of the current code to change the type of the property from int to Integer.
I thought I could map a nullable primative by specifying it's coresponding object type in the mapping XML. Am I wrong? Where do I find a way to solve this issue?
|
|