[jboss-user] [Beginners Corner] - Re: jta transactions - simple question

vitor_b do-not-reply at jboss.com
Fri Nov 17 21:35:39 EST 2006


Thank you for your answer. I put uT.setRollbackOnly() only to check what would happen. Now I've changed this line to:

throw new Exception("dark force exception") 

and rollback method in catch (Exception ex) works quite fine. 
So i belive that failed commit() method is the reason of missed transaction.

I belive also that when i can mark transaction for rolback i must check if the transaction is marked for rollback before call commit() method.

I think the best way will be replace commit() with:

if (uT.getStatus() == Status.STATUS_MARKED_ROLLBACK)
  |      throw new Exception("dark force exception");
  | else 
  |       uT.commit();

I think throwing an exception is a good thing. Exception will be caught, and efter rollback will be thrown to the client. 
Thanks to that client will know that something wrong has happened.

Am I right?



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987029#3987029

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987029

More information about the jboss-user mailing list