-->
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: lazy set works ?
PostPosted: Tue Feb 24, 2009 4:13 pm 
Newbie

Joined: Tue Feb 24, 2009 4:06 pm
Posts: 3
Hello,

I have lazy set and when trying to add new item to that set nhibernate loads all the other, previously saved items.

Question1 : is that ok?

Question2: how to prevent such a behavior?

Thanks

_________________
Acai Berry Fruit Juice Plants
OLED lighting


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2009 7:16 am 
Newbie

Joined: Fri Feb 27, 2009 7:01 am
Posts: 5
The behaviour is normal. The lazy property tells hibernate not to load the object or collection until it is needed (aka accessed). Yet when you add a an item of a collection, you are accessing the collection (hence the load).

I don't believe there is a way arround this.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2009 10:21 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Afaik you can prevent this with using a bag. Since a bag can contain duplicate items hibernate does not have to load the other items make sure that the collection semantics are not violated. But I'm not sure if it really works that way.

_________________
--Wolfgang


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.