public class DefaultTransactionProvider extends java.lang.Object implements TransactionProvider
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)
).
Savepoint
s, if
supported by the underlying JDBC driver, and if nested()
is
true
. To deactivate nested transactions, use
DefaultTransactionProvider(ConnectionProvider, boolean)
.Constructor and Description |
---|
DefaultTransactionProvider(ConnectionProvider connectionProvider) |
DefaultTransactionProvider(ConnectionProvider connectionProvider,
boolean nested) |
Modifier and Type | Method and 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.
|
public DefaultTransactionProvider(ConnectionProvider connectionProvider)
public DefaultTransactionProvider(ConnectionProvider connectionProvider, boolean nested)
nested
- Whether nested transactions via Savepoint
s are
supported.public final boolean nested()
public final void begin(TransactionContext ctx)
TransactionProvider
This method begins a new transaction with a Configuration
scoped
for this transaction. The resulting Transaction
object may be
used by implementors to identify the transaction when
TransactionProvider.commit(TransactionContext)
or
TransactionProvider.rollback(TransactionContext)
is called.
begin
in interface TransactionProvider
ctx
- the configuration scoped to this transaction and its
nested transactions.public final void commit(TransactionContext ctx)
TransactionProvider
commit
in interface TransactionProvider
ctx
- the configuration scoped to this transaction and its nested
transactions.public final void rollback(TransactionContext ctx)
TransactionProvider
rollback
in interface TransactionProvider
ctx
- the configuration scoped to this transaction and its nested
transactions.Copyright © 2018. All Rights Reserved.