-->
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.  [ 6 posts ] 
Author Message
 Post subject: lazy set works strange... or not?
PostPosted: Sat May 14, 2005 7:19 am 
I have lazy set and when trying to add new item to that set nhibernate loads all the other, previously saved items. The question1 is: is that ok? question2: how to prevent such a behavior?


Top
  
 
 Post subject:
PostPosted: Sat May 14, 2005 8:37 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Yes, it's ok, because it needs to check whether the item is already in the set.
To prevent it, use a bag, it will allow duplicates.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 15, 2005 9:02 am 
sergey wrote:
Yes, it's ok, because it needs to check whether the item is already in the set.

Thanx. It's now clear for me. But... Are there any other ways to control PK constraints instead of loading all the records? Eg simply querying COUNT FROM set WHERE id=fresh_added_item_id... I think is it good enough to do so in means of "transparent add to lazy set". Im I right?


Top
  
 
 Post subject:
PostPosted: Sun May 15, 2005 9:09 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
If you want to add a child to a collection without using the collection (hence loading it), you can save the child after setting its parent.

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 15, 2005 9:12 am 
KPixel wrote:
If you want to add a child to a collection without using the collection (hence loading it), you can save the child after setting its parent.

Could it be possible if parent not null?


Top
  
 
 Post subject:
PostPosted: Sun May 15, 2005 9:13 am 
Anonymous wrote:
Could it be possible if parent not null?

sorry. i've got it


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