PDA

View Full Version : Deadlock and isolation level



Denis Burlaka
Jun 2nd, 2009, 10:56 AM
Hello All.

I have the following problem: I have two thread that invoke the same method - methodA(). First thread starts first transaction and lock some data for update, when second thread starts second transaction. The first transaction is suspended and the second transaction tries to update the same data that have been locked by the first transaction and deadlock exception happens.

I try use

@Transactional(propagation=Propagation.REQUIRED, isolation=Isolation.SERIALIZABLE)
but without change.

In my case solution in that the second transactions starts after the first has been finished - good.
How can I resolve this problem? I use Hibernate 3 and MySQL.