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 but insert/update the child?
|
|