1 16 17 package org.springframework.transaction.jta; 18 19 import javax.transaction.Status ; 20 import javax.transaction.SystemException ; 21 import javax.transaction.UserTransaction ; 22 23 import org.springframework.transaction.TransactionSystemException; 24 import org.springframework.transaction.support.SmartTransactionObject; 25 26 37 public class JtaTransactionObject implements SmartTransactionObject { 38 39 private final UserTransaction userTransaction; 40 41 42 47 public JtaTransactionObject(UserTransaction userTransaction) { 48 this.userTransaction = userTransaction; 49 } 50 51 54 public UserTransaction getUserTransaction() { 55 return userTransaction; 56 } 57 58 59 62 public boolean isRollbackOnly() { 63 try { 64 return (getUserTransaction().getStatus() == Status.STATUS_MARKED_ROLLBACK); 65 } 66 catch (SystemException ex) { 67 throw new TransactionSystemException("JTA failure on getStatus", ex); 68 } 69 } 70 71 } 72 | Popular Tags |