Spring Framework

org.springframework.transaction.jta
Class UserTransactionAdapter

java.lang.Object
  extended by org.springframework.transaction.jta.UserTransactionAdapter
All Implemented Interfaces:
javax.transaction.UserTransaction

public class UserTransactionAdapter
extends java.lang.Object
implements javax.transaction.UserTransaction

Adapter for a JTA UserTransaction handle, taking a JTA TransactionManager reference and creating a JTA UserTransaction handle for it.

The JTA UserTransaction interface is an exact subset of the JTA TransactionManager interface. Unfortunately, it does not serve as super-interface of TransactionManager, though, which requires an adapter such as this class to be used when intending to talk to a TransactionManager handle through the UserTransaction interface.

Used internally by Spring's JtaTransactionManager for certain scenarios. Not intended for direct use in application code.

Since:
1.1.5
Author:
Juergen Hoeller

Constructor Summary
UserTransactionAdapter(javax.transaction.TransactionManager transactionManager)
          Create a new UserTransactionAdapter for the given TransactionManager.
 
Method Summary
 void begin()
           
 void commit()
           
 int getStatus()
           
 javax.transaction.TransactionManager getTransactionManager()
          Return the JTA TransactionManager that this adapter delegates to.
 void rollback()
           
 void setRollbackOnly()
           
 void setTransactionTimeout(int timeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserTransactionAdapter

public UserTransactionAdapter(javax.transaction.TransactionManager transactionManager)
Create a new UserTransactionAdapter for the given TransactionManager.

Parameters:
transactionManager - the JTA TransactionManager to wrap
Method Detail

getTransactionManager

public final javax.transaction.TransactionManager getTransactionManager()
Return the JTA TransactionManager that this adapter delegates to.


setTransactionTimeout

public void setTransactionTimeout(int timeout)
                           throws javax.transaction.SystemException
Specified by:
setTransactionTimeout in interface javax.transaction.UserTransaction
Throws:
javax.transaction.SystemException

begin

public void begin()
           throws javax.transaction.NotSupportedException,
                  javax.transaction.SystemException
Specified by:
begin in interface javax.transaction.UserTransaction
Throws:
javax.transaction.NotSupportedException
javax.transaction.SystemException

commit

public void commit()
            throws javax.transaction.RollbackException,
                   javax.transaction.HeuristicMixedException,
                   javax.transaction.HeuristicRollbackException,
                   java.lang.SecurityException,
                   javax.transaction.SystemException
Specified by:
commit in interface javax.transaction.UserTransaction
Throws:
javax.transaction.RollbackException
javax.transaction.HeuristicMixedException
javax.transaction.HeuristicRollbackException
java.lang.SecurityException
javax.transaction.SystemException

rollback

public void rollback()
              throws java.lang.SecurityException,
                     javax.transaction.SystemException
Specified by:
rollback in interface javax.transaction.UserTransaction
Throws:
java.lang.SecurityException
javax.transaction.SystemException

setRollbackOnly

public void setRollbackOnly()
                     throws javax.transaction.SystemException
Specified by:
setRollbackOnly in interface javax.transaction.UserTransaction
Throws:
javax.transaction.SystemException

getStatus

public int getStatus()
              throws javax.transaction.SystemException
Specified by:
getStatus in interface javax.transaction.UserTransaction
Throws:
javax.transaction.SystemException

Spring Framework