-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernates return null for map value object
PostPosted: Fri Dec 08, 2006 7:41 am 
Beginner
Beginner

Joined: Sat Feb 18, 2006 6:24 am
Posts: 23
Hibernates return null for map value object if all persistant properties of the object are set to null.

So, because of this I have a problem.
I have main object with map property. In hibernate mapping, the values of the map are composite elements.
When i instantiate new composite object without setting any of it's properties (they all have null value), and put the composite element in the map, then save main object I get new record in the composite element's database table with relation to main object set correctly, and the map key is also there. all composite element's properties are null as they should be since I did'n asign any values to them. Now, when I load main object from the database in another transaction, I have null value for entire composite element in map, not just it's properties.

I suppose this is the way for hibernate to distinct null values from the values which are not null. (if all values are null then the object is null), but I find that wrong. Why doesn't Hibernate add extra column in the composite elements table called something like "isNull" and use it for detecting null values instead of trying to conclude it from properties?


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

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.