-->
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: How can I remove remove item from session?
PostPosted: Mon Apr 24, 2006 12:09 pm 
Newbie

Joined: Thu Mar 16, 2006 1:12 pm
Posts: 10
Hello all,

I haven't been able to find the answer to this question anywhere and am hoping you can help.

Let's say my application selects a bunch of objects from the database as part of a session. Now, let's say I iterate over the items in that collection and try to update each one. But there's other applications running that are also trying to update the same objects in the database. Eventually, as my application runs, while it is modifying one of the objects and performing commits, I get a StaleObjectException (as I would expect since I have other applications trying to do the same thing that I am doing). How can I "remove" that stale object from my session? In other words, when I get the StaleObjectException, I want my application to "give up" on trying to modify that object - and just "move on" to the next object in the collection. In the current version of my application, I "give up" on the object and attempt to update/commit the next object in the collection - but I keep getting the StaleObjectException from the previous object.

I thought perhaps the session.evict() method might be the answer but Hibernate In Action implies that it's not. I don't see a session.remove method...

Any thoughts?

Thanks!

-john


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.