-->
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.  [ 3 posts ] 
Author Message
 Post subject: PropertyAccessException getting null for an int-property
PostPosted: Fri Oct 29, 2004 5:36 am 
Newbie

Joined: Fri Oct 29, 2004 5:13 am
Posts: 1
Hibernate version: 2.1.6

Name and version of the database you are using: MySQL 4.1.7


Hi!
In my .hbm.xml-File I have this property:
<property type="int" name="test" column="TEST" access="field"/>

Reading datas from columns containing a value works very good. But always when the value is null, I get an Exception:
net.sf.hibernate.PropertyAccessException: could not set a field value by reflection setter of Test.test

To the database I just have read-only access. So what can I do to get rid of this exception?

Sincerely,
Ruediger[/i]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 29, 2004 8:26 am 
Senior
Senior

Joined: Fri Jun 18, 2004 10:17 am
Posts: 140
have you checked that Test.test is int and not some other type like Integer or String?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 29, 2004 8:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
What should hibernate do, you can't set an int to null. Either make your property an Integer, or define a custom UserType mapping null to some int value.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.