Name

Transaction

Synopsis

A Transaction represents a global transaction managed by the transaction manager. When the TransactionManager interface is used directly (by an application server, for example), to create and control transactions, Transaction objects represent the transactions created. The TransactionManager.getTransaction() method is used to get the transaction associated with the current thread. With the Transaction object, the caller can commit() or rollback() the Transaction, enlist or remove resources from the transaction, and get the Transaction's status. The setRollbackOnly() method flags the Transaction so that it can only be rolled back, not committed. The registerSynchronization() method is used to register a Synchronization callback object with the Transaction.

public interface Transaction {
// Public Instance Methods
   public abstract void commit(
        ) throws RollbackException, HeuristicMixedException, HeuristicRollbackException, java.lang.SecurityException;  
   public abstract boolean delistResource(
        javax.transaction.xa.XAResource xaRes, 
        int flag) throws
        java.lang.IllegalStateException, javax.transaction.SystemException;  
   public abstract boolean enlistResource(
        javax.transaction.xa.XAResource xaRes)
        throws RollbackException, java.lang.IllegalStateException, javax.transaction.SystemException;  
   public abstract int getStatus(
        ) throws javax.transaction.SystemException;  
   public abstract void registerSynchronization(
        Synchronization sync) throws RollbackException, java.lang.IllegalStateException, ...

Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.