public class ThreadLocalTransactionProvider extends java.lang.Object implements TransactionProvider
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.
| Constructor and Description |
|---|
ThreadLocalTransactionProvider(ConnectionProvider provider) |
ThreadLocalTransactionProvider(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.
|
void |
rollback(TransactionContext ctx)
Rollback a transaction.
|
public ThreadLocalTransactionProvider(ConnectionProvider provider)
public ThreadLocalTransactionProvider(ConnectionProvider connectionProvider, boolean nested)
nested - Whether nested transactions via Savepoints are
supported.public 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 TransactionProviderctx - the configuration scoped to this transaction and its
nested transactions.public void commit(TransactionContext ctx)
TransactionProvidercommit in interface TransactionProviderctx - the configuration scoped to this transaction and its nested
transactions.public void rollback(TransactionContext ctx)
TransactionProviderrollback in interface TransactionProviderctx - the configuration scoped to this transaction and its nested
transactions.Copyright © 2018. All Rights Reserved.