Hibernate Books

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: Optimistic locking failed
PostPosted: Fri Jul 27, 2012 3:01 pm 
Newbie

Joined: Fri Jul 27, 2012 1:28 pm
Posts: 3
Getting Optimistic locking failed ; staleobjectstateException : Row was updated or deleted by another transaction(or unsaved-value mapping was correct) error for child object.

Have a parent ITEM object and child STOREROOM object. parent to child is many-to-one and hibernate mapping file has cascade=all.

Have JMS fire each item record and item inser or update storeroom record. Since each JMS record is a transaction and commits happens at the end of each item, it looks like multiple thread is accessing child storeroom object and trying to update. So throwing row update error. I added code
session.buildLockRequest(LockOptions.UPGRADE).lock(item) in the begining but didn't help. Any way i can fix this so that child object will not throw error?


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.