-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: PropertyAccessException: exception setting property
PostPosted: Fri Dec 01, 2006 1:09 pm 
Newbie

Joined: Thu Nov 30, 2006 11:08 am
Posts: 6
Location: Manchester, United Kingdom
I have an object with RedemptionPenaltyValue with a property ...

Code:
private double year1Percentage


In the column on the table that this maps to (oracle10g) it is NUMBER(7,3)

I get this exception when the column is null.....

Code:
org.springframework.orm.hibernate3.HibernateSystemException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.hidden.value.RedemptionPenaltyValue.setYear1Percentage; nested exception is org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.hidden.value.RedemptionPenaltyValue.setYear1Percentage
Caused by: org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.hidden.value.RedemptionPenaltyValue.setYear1Percentage
   at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValuesWithOptimizer(PojoEntityTuplizer.java:215)
   at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:185)
   at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3232)
   at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:126)
   at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
....<snip/>


I have figured out that if I change the year1Percentage property (and its getters and setters etc) to a java.lang.Double then it works. Any ideas why???

This is a bit annoying as this is existing code that we are converting from JDBC to Hibernate, and I dont really want to go and change all doubles to Doubles etc.

Thanks

Andy.

_________________
"because dressing like a pirate is cool"


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 7:17 am 
Newbie

Joined: Thu Nov 30, 2006 11:08 am
Posts: 6
Location: Manchester, United Kingdom
Been getting this with ints too?

Any ideas ???

_________________
"because dressing like a pirate is cool"


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 9:20 am 
Regular
Regular

Joined: Mon Nov 24, 2003 6:36 pm
Posts: 105
This is because your code has a primitive double, not DOUBLE, hence you can't have nulls. Primitives can only be used with not-null fields.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 9:52 am 
Newbie

Joined: Thu Nov 30, 2006 11:08 am
Posts: 6
Location: Manchester, United Kingdom
Thanks thought that might be the case.

Andy.

_________________
"because dressing like a pirate is cool"


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.