java.lang.Object
org.jooq.impl.DefaultTransactionProvider
- All Implemented Interfaces:
TransactionProvider
A default implementation for the
TransactionProvider SPI.
This implementation is entirely based on JDBC transactions and is intended to
work with DefaultConnectionProvider (which is implicitly created when
using DSL.using(Connection)).
Nesting of transactions
By default, nested transactions are supported by modeling them implicitly with JDBCSavepoints, if
supported by the underlying JDBC driver, and if nested() is
true. To deactivate nested transactions, use
DefaultTransactionProvider(ConnectionProvider, boolean).- Author:
- Lukas Eder
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultTransactionProvider(ConnectionProvider connectionProvider) DefaultTransactionProvider(ConnectionProvider connectionProvider, boolean nested) DefaultTransactionProvider(ConnectionProvider connectionProvider, boolean nested, TransactionProperty... properties) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidbegin(TransactionContext ctx) Begin a new transaction.final voidcommit(TransactionContext ctx) Commit a transaction.final booleannested()final Set<TransactionProperty> Specify the transaction properties for transactions created by this provider.final voidRollback a transaction.
-
Constructor Details
-
DefaultTransactionProvider
-
DefaultTransactionProvider
- Parameters:
nested- Whether nested transactions viaSavepoints are supported.
-
DefaultTransactionProvider
public DefaultTransactionProvider(ConnectionProvider connectionProvider, boolean nested, TransactionProperty... properties) - Parameters:
nested- Whether nested transactions viaSavepoints are supported.properties- The default transaction properties that are used to create transactions from this provider.
-
-
Method Details
-
properties
Description copied from interface:TransactionProviderSpecify the transaction properties for transactions created by this provider.- Specified by:
propertiesin interfaceTransactionProvider
-
nested
public final boolean nested() -
begin
Description copied from interface:TransactionProviderBegin 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 whenTransactionProvider.commit(TransactionContext)orTransactionProvider.rollback(TransactionContext)is called.- Specified by:
beginin interfaceTransactionProvider- Parameters:
ctx- the configuration scoped to this transaction and its nested transactions.
-
commit
Description copied from interface:TransactionProviderCommit a transaction.- Specified by:
commitin interfaceTransactionProvider- Parameters:
ctx- the configuration scoped to this transaction and its nested transactions.
-
rollback
Description copied from interface:TransactionProviderRollback a transaction.- Specified by:
rollbackin interfaceTransactionProvider- Parameters:
ctx- the configuration scoped to this transaction and its nested transactions.
-