TransactionProvider SPI can be used to implement custom
transaction behaviour that is applied when calling
DSLContext#transactionResult(TransactionalCallable) or
DSLContext#transaction(TransactionalRunnable).
A new Configuration copy is created from the calling
DSLContext for the scope of a single transactions. Implementors may
freely add custom data to Configuration#data(), in order to share
information between begin(TransactionContext) and
commit(TransactionContext) or rollback(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
JDBC Savepoints.
| Modifier and Type | Method and Description |
|---|---|
| public void | begin(TransactionContext
the configuration scoped to this transaction and its
nested transactions. ctx)Begin a new transaction. |
| public void | commit(TransactionContext
the configuration scoped to this transaction and its nested
transactions. ctx)Commit a transaction. |
| public void | rollback(TransactionContext
the configuration scoped to this transaction and its nested
transactions. ctx)Rollback a transaction. |
| begin | back to summary |
|---|---|
| public void begin(TransactionContext ctx) throws DataAccessException Begin a new transaction.
This method begins a new transaction with a
| |
| commit | back to summary |
|---|---|
| public void commit(TransactionContext ctx) throws DataAccessException Commit a transaction.
| |
| rollback | back to summary |
|---|---|
| public void rollback(TransactionContext ctx) throws DataAccessException Rollback a transaction.
| |