-->
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.  [ 2 posts ] 
Author Message
 Post subject: Should I be calling evict to see updates to a collection?
PostPosted: Thu Dec 15, 2005 3:40 pm 
Newbie

Joined: Thu Dec 15, 2005 3:06 pm
Posts: 1
I have a user with a collection of addresses. i load the user by calling Session.Load(typeof(user), userKey). i then retrieve one of these addresses from the user.Addresses collection and call Session.Delete(address) on it within a transaction that is commited. it appears that user.Addresses still contains this deleted address. i believe this is because the address is now transient, but that it still exists in memory.

at this point, if i call Session.Load to reload the same user, i still see the same Addresses collection and it is only if i call Session.Evict(user) that i can then load a user with a address collection that reflects the data within the database

is my understanding correct and are any suggestions for a better way to have the user's address collection show up-to-date data?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 15, 2005 4:20 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
session.Delete only marks the object to be deleted from the database on next flush. It does not remove it from any collections it might be in, that's your responsibility.


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