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: Refresh() changes entity & collection property instances
PostPosted: Tue Dec 16, 2008 7:27 pm 
Expert
Expert

Joined: Fri Oct 28, 2005 5:38 pm
Posts: 390
Location: Cedarburg, WI
ISession.Refresh() changes the instances of entity and collection properties on the refreshed object. This sounds like a very bad idea, because who knows what code was referencing the old instances of those entity and collection properties.

Why would Refresh() be implemented to have this horrible side effect? Was it just the easiest way to do it, and no one thought about the consequences? I thought it was standard practice that properties always return the same instance as long as logical meaning of the value has not changed, and that collection properties in particular should never change their underlying instance during the owning object's lifetime.


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.