UserTransaction.getStatus() method is always returning the value ‘6’, even immediately after performing rollback or commit. Cannot understand why the status is not changing. Can someone point out whats wrong here?
I am using WAS 6.1.
InitialContext context = new InitialContext();
UserTransaction utx = (UserTransaction)context.lookup("java:comp/UserTransaction");
System.out.println("Transaction status = "+utx.getStatus()); //value is 6
utx.begin()
//all work done here
if(all good) {utx.commit()}
else {
utx.rollback();
System.out.println("Transaction status = "+utx.getStatus()); //value is 6
}
The value 6 means
STATUS_NO_TRANSACTION. It is normal that you get this result before the start of the transaction and after the commit or rollback.