Package org.jooq.impl
Class ThreadLocalTransactionProvider
- java.lang.Object
-
- org.jooq.impl.ThreadLocalTransactionProvider
-
- All Implemented Interfaces:
TransactionProvider
public class ThreadLocalTransactionProvider extends java.lang.Object implements TransactionProvider
ATransactionProviderthat implements thread-bound transaction semantics.Use this
TransactionProviderif your transactions are thread-bound, meaning that a transaction and its underlyingConnectionwill never leave the thread that started the transaction.When this
TransactionProvideris used, users must pass their customConnectionProviderimplementations to thisTransactionProvider, instead of passing it to theConfiguration.- Author:
- Lukas Eder
-
-
Constructor Summary
Constructors Constructor Description ThreadLocalTransactionProvider(ConnectionProvider connectionProvider)ThreadLocalTransactionProvider(ConnectionProvider connectionProvider, boolean nested)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbegin(TransactionContext ctx)Begin a new transaction.voidcommit(TransactionContext ctx)Commit a transaction.voidrollback(TransactionContext ctx)Rollback a transaction.
-
-
-
Constructor Detail
-
ThreadLocalTransactionProvider
public ThreadLocalTransactionProvider(ConnectionProvider connectionProvider)
-
ThreadLocalTransactionProvider
public ThreadLocalTransactionProvider(ConnectionProvider connectionProvider, boolean nested)
- Parameters:
nested- Whether nested transactions viaSavepoints are supported.
-
-
Method Detail
-
begin
public void begin(TransactionContext ctx)
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
public void commit(TransactionContext ctx)
Description copied from interface:TransactionProviderCommit a transaction.- Specified by:
commitin interfaceTransactionProvider- Parameters:
ctx- the configuration scoped to this transaction and its nested transactions.
-
rollback
public void rollback(TransactionContext ctx)
Description copied from interface:TransactionProviderRollback a transaction.- Specified by:
rollbackin interfaceTransactionProvider- Parameters:
ctx- the configuration scoped to this transaction and its nested transactions.
-
-