- java.lang.Object
-
- org.jooq.impl.DefaultTransactionProvider
-
- All Implemented Interfaces:
TransactionProvider
public class DefaultTransactionProvider extends Object implements TransactionProvider
A default implementation for theTransactionProvider
SPI.This implementation is entirely based on JDBC transactions and is intended to work with
DefaultConnectionProvider
(which is implicitly created when usingDSL.using(Connection)
).Nesting of transactions
By default, nested transactions are supported by modeling them implicitly with JDBCSavepoint
s, if supported by the underlying JDBC driver, and ifnested()
istrue
. To deactivate nested transactions, useDefaultTransactionProvider(ConnectionProvider, boolean)
.- Author:
- Lukas Eder
-
-
Constructor Summary
Constructors Constructor Description DefaultTransactionProvider(ConnectionProvider connectionProvider)
DefaultTransactionProvider(ConnectionProvider connectionProvider, boolean nested)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
begin(TransactionContext ctx)
Begin a new transaction.void
commit(TransactionContext ctx)
Commit a transaction.boolean
nested()
void
rollback(TransactionContext ctx)
Rollback a transaction.
-
-
-
Constructor Detail
-
DefaultTransactionProvider
public DefaultTransactionProvider(ConnectionProvider connectionProvider)
-
DefaultTransactionProvider
public DefaultTransactionProvider(ConnectionProvider connectionProvider, boolean nested)
- Parameters:
nested
- Whether nested transactions viaSavepoint
s are supported.
-
-
Method Detail
-
nested
public final boolean nested()
-
begin
public final void begin(TransactionContext ctx)
Description copied from interface:TransactionProvider
Begin a new transaction.This method begins a new transaction with a
Configuration
scoped for this transaction. The resultingTransaction
object may be used by implementors to identify the transaction whenTransactionProvider.commit(TransactionContext)
orTransactionProvider.rollback(TransactionContext)
is called.- Specified by:
begin
in interfaceTransactionProvider
- Parameters:
ctx
- the configuration scoped to this transaction and its nested transactions.
-
commit
public final void commit(TransactionContext ctx)
Description copied from interface:TransactionProvider
Commit a transaction.- Specified by:
commit
in interfaceTransactionProvider
- Parameters:
ctx
- the configuration scoped to this transaction and its nested transactions.
-
rollback
public final void rollback(TransactionContext ctx)
Description copied from interface:TransactionProvider
Rollback a transaction.- Specified by:
rollback
in interfaceTransactionProvider
- Parameters:
ctx
- the configuration scoped to this transaction and its nested transactions.
-
-