-->
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: mapping int
PostPosted: Mon Mar 15, 2004 4:23 pm 
Beginner
Beginner

Joined: Wed Feb 25, 2004 10:58 am
Posts: 43
my java object has a field of type int . When I select information for the database with this object and field is null in the database I get "net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter " . If I change the field in my object to Integer .. it works , obviously because an int cannot be null ? This is my guess . Is there any way to handle nulls or do I have to uses an Integer for the mapping


Top
 Profile  
 
 Post subject: int can not be null
PostPosted: Mon Mar 15, 2004 4:43 pm 
Beginner
Beginner

Joined: Thu Sep 04, 2003 2:50 pm
Posts: 45
Location: US: New York NY
I may be wrong here, but I think that you have to either use Integer or update your null db columns to 0. Heck, you can't make in java

int x = null;

so, no reason to suppose that Hibernate should do that for you.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 15, 2004 5:26 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
int cannot be null, check java basics... ,


Work with Integer for NUMBER fields that can be null


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.