-->
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: Hibernate Error
PostPosted: Tue Jun 22, 2010 2:28 am 
Newbie

Joined: Tue Jun 22, 2010 2:23 am
Posts: 1
org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException: Object of class [com.ikya.production.det.ProdJobTransactionDet] with identifier [8]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.ikya.production.det.ProdJobTransactionDet#8]

i got the above error while i am updating a grails domain class with a hasmany relation to det? How can i solve it?


Top
 Profile  
 
 Post subject: Re: Hibernate Error
PostPosted: Wed Jun 23, 2010 12:13 pm 
Newbie

Joined: Thu Dec 17, 2009 2:46 pm
Posts: 5
Quoting http://www.cs.bham.ac.uk/~aps/syllabi/2 ... versioning

"Now whenever you make an object dirty in memory, Hibernate will update its version (in memory). Whenever the object gets flushed to disk (e.g., at the end of a transaction or because you call session.update or session.saveOrUpdate to re-attach a detached object, Hibernate will throw a StaleObjectStateException if the version number of the object on disk is not the same as it was when the object was loaded. By catching that exception, the programmer can then decide what to do about the conflict (e.g., report back to the user that the choice he/she has just made is, in fact, no longer available and could they please make another one). "


I'd say that you have 2 or more overlapping transactions, acting over the same entity instance. And, since Hibernate optimistic concurrency control doesn't allow that, you should try a locking scheme, like executing those actions within a synchronized block.


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.