-
- All Known Implementing Classes:
DefaultTransactionProvider,NoTransactionProvider,ThreadLocalTransactionProvider
public interface TransactionProviderTheTransactionProviderSPI can be used to implement customtransactionbehaviour that is applied when callingDSLContext.transactionResult(TransactionalCallable)orDSLContext.transaction(TransactionalRunnable).A new
Configurationcopy is created from the callingDSLContextfor the scope of a single transactions. Implementors may freely add custom data toConfiguration.data(), in order to share information betweenbegin(TransactionContext)andcommit(TransactionContext)orrollback(TransactionContext), as well as to share information with nested transactions.Implementors may freely choose whether they support nested transactions. An example implementation supporting nested transactions is
DefaultTransactionProvider, which implements such transactions using JDBCSavepoints.- Author:
- Lukas Eder
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidbegin(TransactionContext ctx)Begin a new transaction.voidcommit(TransactionContext ctx)Commit a transaction.voidrollback(TransactionContext ctx)Rollback a transaction.
-
-
-
Method Detail
-
begin
void begin(TransactionContext ctx) throws DataAccessException
Begin a new transaction.This method begins a new transaction with a
Configurationscoped for this transaction. The resultingTransactionobject may be used by implementors to identify the transaction whencommit(TransactionContext)orrollback(TransactionContext)is called.- Parameters:
ctx- the configuration scoped to this transaction and its nested transactions.- Throws:
DataAccessException- Any exception issued by the underlying database.
-
commit
void commit(TransactionContext ctx) throws DataAccessException
Commit a transaction.- Parameters:
ctx- the configuration scoped to this transaction and its nested transactions.- Throws:
DataAccessException- Any exception issued by the underlying database.
-
rollback
void rollback(TransactionContext ctx) throws DataAccessException
Rollback a transaction.- Parameters:
ctx- the configuration scoped to this transaction and its nested transactions.- Throws:
DataAccessException- Any exception issued by the underlying database.
-
-