Joined: Thu Sep 22, 2011 9:06 am Posts: 16
|
I am using two different database. I am using two different session for delete records from both database.The code is below : try{ Session session1 = factory.getSession(); Transaction trn1 = session1.beginTrn(); session1.delete(foobar); trn1.commit(); Session session2 = jbomContext.getGrahpSession(); Transaction trn2 = session2.beginTrn(); session2.delete(box);`enter code here` trn2.commit(); }catch(Exception e){ trn1.rollback(); trn2.rollback(); }
Here, the problem is if the error is occurred in transaction2 i couldn't rollback the transaction1.I have some idea about two phase commit. but i need to rollback the transaction if exception will happen both transaction.
Thanks in advance.
|
|