-->
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.  [ 5 posts ] 
Author Message
 Post subject: Lazy Collection Fully Initialized on Add
PostPosted: Wed Oct 26, 2005 3:33 pm 
Senior
Senior

Joined: Sat Sep 10, 2005 3:46 pm
Posts: 178
I am working with a standard parent-child relationship. I have noticed that when adding a child to the parent's children collection as described in the documentation under "Example:Parent/Child", the entire collection is completely initialized. Is there any way to prevent this? Since NHibernate is using a proxy for collections, it seems like it could be possible to avoid initializing the entire collection when an item is added.

Is there any way to avoid this hit? Do I have any alternatives?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 4:09 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
All collections except bags are required to return some value from their Add method to indicate whether the addition was successful or what is the position of the new item. Bags are an exception and calling Add on an IList mapped as a <bag> will not cause it to initialize.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 5:17 pm 
Senior
Senior

Joined: Sat Sep 10, 2005 3:46 pm
Posts: 178
A bag did not initialize the collection on an add, so that is good, but an add of a child with a bag mapping doesn't seem to be updating the version of the parent item. Is this by design?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 6:29 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
The version should get updated at commit. If it isn't then it's a bug.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 6:56 pm 
Senior
Senior

Joined: Sat Sep 10, 2005 3:46 pm
Posts: 178
I have verified, the version is not getting updated on an add to the collection. However, an insert into a specific index does cause the parent's verison to update, and a remove from the collection also causes the parent's version to update.

Should I log this as a bug?


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