-->
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: how to work around this instance of StaleObjectException
PostPosted: Wed Jun 28, 2006 8:45 am 
Regular
Regular

Joined: Thu Sep 16, 2004 4:56 pm
Posts: 80
I have a ReleaseDBO which has a list of RequirementDBOs. When two users(in two different hibernate sessions) add a RequirementDBO, it has code like so.....

release.addRequirement(req); //this in turn also calls req.setRelease
//updating the other end of the association
session.merge(req);


There is a requirements table where this requirement would get added and the release id would be set in the foreign key release column.

This code works great except when two users use it. I would really like to add the second users requirement too. His requirement is not stale...his release might be stale because it doesn't contain the requirement just added in the other session, but I don't really care and neither does my user in this case. How can I work around this problem so the users data is committed.

thanks,
dean


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 28, 2006 5:52 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Set select-before-update="true" in your class definition.

_________________
Code tags are your friend. Know them and use them.


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.