Class UserTransactionAdapter
- java.lang.Object
- org.springframework.transaction.jta.UserTransactionAdapter
- All Implemented Interfaces:
UserTransaction
public class UserTransactionAdapter extends Object implements UserTransaction
Adapter for a JTA UserTransaction handle, taking a JTATransactionManagerreference and creating a JTAUserTransactionhandle 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
JtaTransactionManagerfor certain scenarios. Not intended for direct use in application code.- Since:
- 1.1.5
- Author:
- Juergen Hoeller
Constructor Summary
Constructors Constructor Description UserTransactionAdapter(TransactionManager transactionManager)Create a new UserTransactionAdapter for the given TransactionManager.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbegin()voidcommit()intgetStatus()TransactionManagergetTransactionManager()Return the JTA TransactionManager that this adapter delegates to.voidrollback()voidsetRollbackOnly()voidsetTransactionTimeout(int timeout)
Constructor Detail
UserTransactionAdapter
public UserTransactionAdapter(TransactionManager transactionManager)
Create a new UserTransactionAdapter for the given TransactionManager.- Parameters:
transactionManager- the JTA TransactionManager to wrap
Method Detail
getTransactionManager
public final TransactionManager getTransactionManager()
Return the JTA TransactionManager that this adapter delegates to.
setTransactionTimeout
public void setTransactionTimeout(int timeout) throws SystemException
- Specified by:
setTransactionTimeoutin interfaceUserTransaction- Throws:
SystemException
begin
public void begin() throws NotSupportedException, SystemException
- Specified by:
beginin interfaceUserTransaction- Throws:
NotSupportedExceptionSystemException
commit
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, SystemException
- Specified by:
commitin interfaceUserTransaction- Throws:
RollbackExceptionHeuristicMixedExceptionHeuristicRollbackExceptionSecurityExceptionSystemException
rollback
public void rollback() throws SecurityException, SystemException
- Specified by:
rollbackin interfaceUserTransaction- Throws:
SecurityExceptionSystemException
setRollbackOnly
public void setRollbackOnly() throws SystemException
- Specified by:
setRollbackOnlyin interfaceUserTransaction- Throws:
SystemException
getStatus
public int getStatus() throws SystemException
- Specified by:
getStatusin interfaceUserTransaction- Throws:
SystemException