Class UserTransactionAdapter
java.lang.Object
org.springframework.transaction.jta.UserTransactionAdapter
- All Implemented Interfaces:
jakarta.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
ConstructorsConstructorDescriptionUserTransactionAdapter(jakarta.transaction.TransactionManager transactionManager) Create a new UserTransactionAdapter for the given TransactionManager. -
Method Summary
Modifier and TypeMethodDescriptionvoidbegin()voidcommit()intfinal jakarta.transaction.TransactionManagerReturn the JTA TransactionManager that this adapter delegates to.voidrollback()voidvoidsetTransactionTimeout(int timeout)
-
Constructor Details
-
UserTransactionAdapter
public UserTransactionAdapter(jakarta.transaction.TransactionManager transactionManager) Create a new UserTransactionAdapter for the given TransactionManager.- Parameters:
transactionManager- the JTA TransactionManager to wrap
-
-
Method Details
-
getTransactionManager
public final jakarta.transaction.TransactionManager getTransactionManager()Return the JTA TransactionManager that this adapter delegates to. -
setTransactionTimeout
public void setTransactionTimeout(int timeout) throws jakarta.transaction.SystemException - Specified by:
setTransactionTimeoutin interfacejakarta.transaction.UserTransaction- Throws:
jakarta.transaction.SystemException
-
begin
public void begin() throws jakarta.transaction.NotSupportedException, jakarta.transaction.SystemException- Specified by:
beginin interfacejakarta.transaction.UserTransaction- Throws:
jakarta.transaction.NotSupportedExceptionjakarta.transaction.SystemException
-
commit
public void commit() throws jakarta.transaction.RollbackException, jakarta.transaction.HeuristicMixedException, jakarta.transaction.HeuristicRollbackException, SecurityException, jakarta.transaction.SystemException- Specified by:
commitin interfacejakarta.transaction.UserTransaction- Throws:
jakarta.transaction.RollbackExceptionjakarta.transaction.HeuristicMixedExceptionjakarta.transaction.HeuristicRollbackExceptionSecurityExceptionjakarta.transaction.SystemException
-
rollback
- Specified by:
rollbackin interfacejakarta.transaction.UserTransaction- Throws:
SecurityExceptionjakarta.transaction.SystemException
-
setRollbackOnly
public void setRollbackOnly() throws jakarta.transaction.SystemException- Specified by:
setRollbackOnlyin interfacejakarta.transaction.UserTransaction- Throws:
jakarta.transaction.SystemException
-
getStatus
public int getStatus() throws jakarta.transaction.SystemException- Specified by:
getStatusin interfacejakarta.transaction.UserTransaction- Throws:
jakarta.transaction.SystemException
-