- All Known Implementing Classes:
DefaultTransactionManager
public interface TransactionManager
The TransactionManager API.
- Author:
- Manfred Riem ([email protected])
-
Method Summary
Modifier and Type Method Description void
begin()
Begin a new transaction.void
commit()
Commit the transaction.int
getStatus()
Get the status.Transaction
getTransaction()
Get the transaction.void
resume(Transaction transaction)
Resume the transaction.void
rollback()
Rollback the transaction.void
setRollbackOnly()
Set to rollback only.void
setTransactionTimeout(int seconds)
Set the transaction timeout.Transaction
suspend()
Suspend the transaction.
-
Method Details
-
begin
Begin a new transaction.- Throws:
NotSupportedException
- when nested transactions are not supported.SystemException
- when a serious error occurs.
-
commit
void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, java.lang.SecurityException, java.lang.IllegalStateException, SystemExceptionCommit the transaction.- Throws:
RollbackException
- when the transaction has been rolled back.HeuristicMixedException
- when the transaction was partially committed.HeuristicRollbackException
- when the transaction was rolled back.java.lang.SecurityException
- when the transaction is not allowed to commit.SystemException
- when a serious error occurs.java.lang.IllegalStateException
-
getStatus
Get the status.- Returns:
- the status.
- Throws:
SystemException
- when a serious error occurs.
-
getTransaction
Get the transaction.- Returns:
- the transaction.
- Throws:
SystemException
- when a serious error occurs.
-
resume
void resume(Transaction transaction) throws InvalidTransactionException, java.lang.IllegalStateException, SystemExceptionResume the transaction.- Parameters:
transaction
- the transaction to resume.- Throws:
InvalidTransactionException
- when an invalid transaction was passed in.java.lang.IllegalStateException
- when the thread is already associated with a transaction.SystemException
- when a serious error occurs.
-
rollback
void rollback() throws java.lang.IllegalStateException, java.lang.SecurityException, SystemExceptionRollback the transaction.- Throws:
java.lang.IllegalStateException
- when not associated with a transaction.java.lang.SecurityException
- when the transaction is not allowed to commit.SystemException
- when a serious error occurs.
-
setRollbackOnly
Set to rollback only.- Throws:
java.lang.IllegalStateException
- when not associated with a transaction.SystemException
- when a serious error occurs.
-
setTransactionTimeout
Set the transaction timeout.- Parameters:
seconds
- the timeout in seconds.- Throws:
SystemException
- when a serious error occurs.
-
suspend
Suspend the transaction.- Returns:
- the transaction, or null if not associated with a transaction.
- Throws:
SystemException
- when a serious error occurs.
-