java.lang.Object
org.jooq.impl.ThreadLocalTransactionProvider
- All Implemented Interfaces:
TransactionProvider
A
TransactionProvider
that implements thread-bound transaction
semantics.
Use this TransactionProvider
if your transactions are
thread-bound, meaning that a transaction and its underlying
Connection
will never leave the thread that started the transaction.
When this TransactionProvider
is used, users must pass their
custom ConnectionProvider
implementations to this
TransactionProvider
, instead of passing it to the
Configuration
.
- Author:
- Lukas Eder
-
Constructor Summary
ConstructorDescriptionThreadLocalTransactionProvider
(ConnectionProvider connectionProvider) ThreadLocalTransactionProvider
(ConnectionProvider connectionProvider, boolean nested) -
Method Summary
Modifier and TypeMethodDescriptionvoid
begin
(TransactionContext ctx) Begin a new transaction.void
commit
(TransactionContext ctx) Commit a transaction.void
Rollback a transaction.
-
Constructor Details
-
ThreadLocalTransactionProvider
-
ThreadLocalTransactionProvider
- Parameters:
nested
- Whether nested transactions viaSavepoint
s are supported.
-
-
Method Details
-
begin
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
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
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.
-