-->
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: Collection Was Evicted
PostPosted: Tue Jun 28, 2005 9:59 am 
Newbie

Joined: Tue Jun 28, 2005 9:51 am
Posts: 2
Hibernate version:
3.0.3

What other reason could their be for a collection being evicted from the session if

A) We are dealing with the same session for the entire thread
B) Evict() was never called

I'm noticing that, after a rollback in a transaction, I'm losing one of my collections.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 28, 2005 10:22 am 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
Yeah, from my experience, you need to close your session and open a new one after a rollback.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 28, 2005 10:42 am 
Newbie

Joined: Tue Jun 28, 2005 9:51 am
Posts: 2
Interesting....since all of my calls to my DAOs are through a service, and the service methods are transacted (I'm using Spring's transaction demarcation system), I'm wondering where I will call open/close. It should really happen in Spring's transaction manager. Seems like a waste of cycles, however, as close/open will invalidate the cache and detach all existing objects

Will lazy loading on a detached object work after closing/opening the session?

In my case, the session is attached to a threadlocal object.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 28, 2005 1:20 pm 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
Coworker ran into this earlier this morning as well, no evict getting called but haven't taken the time to sit down and see what was going on. If you find out be sure to post.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 7:06 pm 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
Ok, perhaps I have some light to shed on this.

For us, it seems to happen if we load up a collection of objects from DB and start iterating through them, call clear() on the session and then call a property on any of the objects that will trigger a lazy load.

Would the solution for this be to lock the object back into the session as we process each one? We're calling clear since we're in a rather large piece of work and want to keep the mem usage in check.

Would something like evict() be a preferred technique in this case?


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.