-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate Two transaction commit problem
PostPosted: Thu Sep 22, 2011 9:11 am 
Newbie

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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.