- All Known Implementing Classes:
LocalTransactionManager
public interface TransactionManager
A transaction manager.
The implementation instance must be thread safe.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanhasSavepoint(String savepointName) Whether the current transaction has the save point.booleanWhether the current transaction is marked to be undone.voidnotSupported(Runnable block) Executes the transaction whose attribute is NOT_SUPPORTED.<RESULT> RESULTnotSupported(Supplier<RESULT> supplier) Executes the transaction whose attribute is NOT_SUPPORTED and returns the result.voidnotSupported(TransactionIsolationLevel isolationLevel, Runnable block) Executes the transaction whose attribute is NOT_SUPPORTED with the specified transaction isolation level.<RESULT> RESULTnotSupported(TransactionIsolationLevel isolationLevel, Supplier<RESULT> supplier) Executes the transaction whose attribute is NOT_SUPPORTED with the specified transaction isolation level and return the result.voidreleaseSavepoint(String savepointName) Removes the specified save point and subsequent save points from the current transaction.voidExecutes the transaction whose attribute is REQUIRED.<RESULT> RESULTExecutes the transaction whose attribute is REQUIRED and returns the result.voidrequired(TransactionIsolationLevel isolationLevel, Runnable block) Executes the transaction whose attribute is REQUIRED with the specified transaction isolation level.<RESULT> RESULTrequired(TransactionIsolationLevel isolationLevel, Supplier<RESULT> supplier) Executes the transaction whose attribute is REQUIRED with the specified transaction isolation level and return the result.voidrequiresNew(Runnable block) Executes the transaction whose attribute is REQUIRES_NEW.<RESULT> RESULTrequiresNew(Supplier<RESULT> supplier) Executes the transaction whose attribute is REQUIRES_NEW and returns the result.voidrequiresNew(TransactionIsolationLevel isolationLevel, Runnable block) Executes the transaction whose attribute is REQUIRES_NEW with the specified transaction isolation level.<RESULT> RESULTrequiresNew(TransactionIsolationLevel isolationLevel, Supplier<RESULT> supplier) Executes the transaction whose attribute is REQUIRES_NEW with the specified transaction isolation level and return the result.voidUndoes all changes made after the given save point.voidMarks the current transaction to undo in the end of the transaction.voidsetSavepoint(String savepointName) Creates a save point with the specified name.
-
Method Details
-
required
Executes the transaction whose attribute is REQUIRED.- Parameters:
block- the code that is executed in the transaction
-
required
Executes the transaction whose attribute is REQUIRED with the specified transaction isolation level.- Parameters:
isolationLevel- the transaction isolation levelblock- the code that is executed in the transaction
-
required
Executes the transaction whose attribute is REQUIRED and returns the result.- Type Parameters:
RESULT- the result type- Parameters:
supplier- the code that is executed in the transaction- Returns:
- the result
-
required
Executes the transaction whose attribute is REQUIRED with the specified transaction isolation level and return the result.- Type Parameters:
RESULT- the result type- Parameters:
isolationLevel- the transaction isolation levelsupplier- the code that is executed in the transaction- Returns:
- the result
-
requiresNew
Executes the transaction whose attribute is REQUIRES_NEW.- Parameters:
block- the code that is executed in the transaction
-
requiresNew
Executes the transaction whose attribute is REQUIRES_NEW with the specified transaction isolation level.- Parameters:
isolationLevel- the transaction isolation levelblock- the code that is executed in the transaction
-
requiresNew
Executes the transaction whose attribute is REQUIRES_NEW and returns the result.- Type Parameters:
RESULT- the result type- Parameters:
supplier- the code that is executed in the transaction- Returns:
- the result
-
requiresNew
Executes the transaction whose attribute is REQUIRES_NEW with the specified transaction isolation level and return the result.- Type Parameters:
RESULT- the result type- Parameters:
isolationLevel- the transaction isolation levelsupplier- the code that is executed in the transaction- Returns:
- the result
-
notSupported
Executes the transaction whose attribute is NOT_SUPPORTED.- Parameters:
block- the code that is executed in the transaction
-
notSupported
Executes the transaction whose attribute is NOT_SUPPORTED with the specified transaction isolation level.- Parameters:
isolationLevel- the transaction isolation levelblock- the code that is executed in the transaction
-
notSupported
Executes the transaction whose attribute is NOT_SUPPORTED and returns the result.- Type Parameters:
RESULT- the result type- Parameters:
supplier- the code that is executed in the transaction- Returns:
- the result
-
notSupported
Executes the transaction whose attribute is NOT_SUPPORTED with the specified transaction isolation level and return the result.- Type Parameters:
RESULT- the result type- Parameters:
isolationLevel- the transaction isolation levelsupplier- the code that is executed in the transaction- Returns:
- the result
-
setRollbackOnly
void setRollbackOnly()Marks the current transaction to undo in the end of the transaction. -
isRollbackOnly
boolean isRollbackOnly()Whether the current transaction is marked to be undone.- Returns:
trueif the current transaction is marked.
-
setSavepoint
Creates a save point with the specified name.Begin a transaction before invoking this method.
- Parameters:
savepointName- the name of the save point- Throws:
DomaNullPointerException- if thesavepointNameisnullTransactionNotYetBegunException- if the transaction is not begunSavepointAlreadyExistsException- if the save point already existsJdbcException- if a JDBC related error occurs
-
hasSavepoint
Whether the current transaction has the save point.Begin a transaction before invoking this method.
- Parameters:
savepointName- the name of the save point- Returns:
trueif the transaction has the save point- Throws:
DomaNullPointerException- if thesavepointNameisnullTransactionNotYetBegunException- if the transaction is not begun
-
releaseSavepoint
Removes the specified save point and subsequent save points from the current transaction.Begin a transaction before invoking this method.
- Parameters:
savepointName- the name of the save point- Throws:
DomaNullPointerException- if thesavepointNameisnullTransactionNotYetBegunException- if the transaction is not yet begunJdbcException- if a JDBC related error occurs
-
rollback
Undoes all changes made after the given save point.Begin a transaction before invoking this method.
- Parameters:
savepointName- the name of the save point- Throws:
DomaNullPointerException- if thesavepointNameisnullSavepointNotFoundException- if the save point is not foundTransactionNotYetBegunException- if the transaction is not begunJdbcException- if a JDBC related error occurs
-