views:

107

answers:

2

I'm having the following structure of code in the service class. The problem is in the event of the exception, the transaction only rollback for "insert A()". I'm using spring-ibatis.

function save
{
 insert A();

 for loop_1()
 {
   insert B()
   insert C()
   insert D() 
 }

 for loop_2()
 {
  insert E()   
  insert F()  --> throws RunTimeException
 }
}
A: 

I think you'd better check the transaction propagation setting for method B(),C(),D(),E() and make sure they are excuted in the same physical transaction with the method A(),F().

Which one do you use, PROPAGATION_REQUIRED or PROPAGATION_REQUIRES_NEW?

Kevin Yang
A: 

Thank you all, I didn't notice one of my tables is not InnoDB (I'm using mysql). I changed it to InnoDB and now the transaction is working. Thank you very much for all the answers and concerns.

zawhtut