Atomikos Forum |
|
Hi!
I have two UserTransaction - outer and inner. If I rollback outer, inner transaction rollbacks too by default. How I can to create new independent inner UserTransaction? UserTransaction ut1 = new UserTransactionImp(); ut1.begin(); // some work 1 UserTransaction ut2 = new UserTransactionImp(); ut2.begin(); // some work 2 - I want to save this work! ut2.commit(); ut1.rollback();
Hi,
Try using the UserTransactionManagerImp instead, and call suspend() right before starting the second transaction, like this: TransactionManager utm = new UserTransactionManagerImp(); utm.begin(); ... Transaction t1 = utm.suspend(); //start new tx - you can reuse the same utm instance or another utm.begin(); ... utm.commit(); utm.resume ( t1 ); ... utm.rollback(); HTH |