[jboss-user] [EJB 3.0] - Concurrency & Optimistic locking

georgesberscheid do-not-reply at jboss.com
Wed Jul 4 09:47:08 EDT 2007


Hi,

I have transaction T1 who's calling em.find() to retrieve and modify an entity E1.
Is there any way to make em.find() in T2 wait to return entity E1 until T1 has committed the changes on E1.
This is, knowing that T1 has started before T2.

I want to prevent T2 from throwing an OptimisticLockException and to make it retry reading / writing E1 until no other transaction is active anymore.

If I call em.lock(E1, LockModeType.READ) in T1 before T2 starts, will em.find() T2 throw an exception or will it wait until T1 has committed (or rolled back) before returning E1?

Thanks a lot,
Georges

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060480#4060480

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060480



More information about the jboss-user mailing list