-->
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: ? on one-to-many returning null vs. empty set (bug/design?)
PostPosted: Wed Mar 08, 2006 12:40 pm 
Newbie

Joined: Mon Jul 25, 2005 4:35 pm
Posts: 9
Hibernate version: Hibernate 3.1.2

I have a one-to-many relationship to a set of objects that may or may not be there. In hibernate2 we would always get an empty set returned. In hibernate3 I we sometimes get an empty set and sometimes a null.

I am currently trying to figure out why the change (lazy set to true false, inverse settings, etc). I am trying to determine if there is a bug in our mapping file, generated class, or if there is a bug in hibernate 3 or if this is designed? If it is "as designed" I at least know not to keep trying to "fix" it.

If this is "as designed" any additional information to when it is null vs. when it is an empty set would be appriciated.

Code:
<set name="somethingSets" lazy="true" cascade="none" inverse="true">
   <meta attribute="scope-set">private</meta>
   <meta attribute="scope-get">public</meta>
   <key column="KEY_ID"/>
   <one-to-many class="SomethingImpl"/>
</set>


I have tried changing the lazy, inverse, and cascade attributes w/out any success.

I have also tried to initialize the set to an empty hashSet in the generated class, but no luck either

Code:
private Set somethingSets = new HashSet();


Thanks.

-Neil


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.