jakarta.transaction.TransactionManager reference and creating
a JTA jakarta.transaction.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.
| Modifier and Type | Field and Description |
|---|---|
| private final TransactionManager |
| Access | Constructor and Description |
|---|---|
| public | UserTransactionAdapter(TransactionManager
the JTA TransactionManager to wrap transactionManager)Create a new UserTransactionAdapter for the given TransactionManager. |
| Modifier and Type | Method and Description |
|---|---|
| public void | begin()
Implements jakarta. Create a new transaction and associate it with the current thread. |
| public void | commit()
Implements jakarta. Complete the transaction associated with the current thread. |
| public int | getStatus()
Implements jakarta. Obtain the status of the transaction associated with the current thread. |
| public final TransactionManager | |
| public void | rollback()
Implements jakarta. Roll back the transaction associated with the current thread. |
| public void | setRollbackOnly()
Implements jakarta. Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction. |
| public void | setTransactionTimeout(int
The value of the timeout in seconds. If the value is zero,
the transaction service restores the default value. If the value
is negative a SystemException is thrown. timeout)Implements jakarta. Modify the timeout value that is associated with transactions started by the current thread with the begin method. |
| transactionManager | back to summary |
|---|---|
| private final TransactionManager transactionManager | |
| UserTransactionAdapter | back to summary |
|---|---|
| public UserTransactionAdapter(TransactionManager transactionManager) Create a new UserTransactionAdapter for the given TransactionManager.
| |
| begin | back to summary |
|---|---|
| public void begin() throws NotSupportedException, SystemException Implements jakarta. Doc from jakarta. Create a new transaction and associate it with the current thread.
| |
| commit | back to summary |
|---|---|
| public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, SystemException Implements jakarta. Doc from jakarta. Complete the transaction associated with the current thread. When this method completes, the thread is no longer associated with a transaction.
| |
| getStatus | back to summary |
|---|---|
| public int getStatus() throws SystemException Implements jakarta. Doc from jakarta. Obtain the status of the transaction associated with the current thread.
| |
| getTransactionManager | back to summary |
|---|---|
| public final TransactionManager getTransactionManager() Return the JTA TransactionManager that this adapter delegates to. | |
| rollback | back to summary |
|---|---|
| public void rollback() throws SecurityException, SystemException Implements jakarta. Doc from jakarta. Roll back the transaction associated with the current thread. When this method completes, the thread is no longer associated with a transaction.
| |
| setRollbackOnly | back to summary |
|---|---|
| public void setRollbackOnly() throws SystemException Implements jakarta. Doc from jakarta. Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.
| |
| setTransactionTimeout | back to summary |
|---|---|
| public void setTransactionTimeout(int timeout) throws SystemException Implements jakarta. Doc from jakarta. Modify the timeout value that is associated with transactions started by the current thread with the begin method. If an application has not called this method, the transaction service uses some default value for the transaction timeout.
| |