public class ThreadLocalTransactionProvider extends 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) |
void |
rollback(TransactionContext ctx) |
public ThreadLocalTransactionProvider(ConnectionProvider provider)
public ThreadLocalTransactionProvider(ConnectionProvider connectionProvider, boolean nested)
nested
- Whether nested transactions via Savepoint
s 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 TransactionProvider
public void commit(TransactionContext ctx)
commit
in interface TransactionProvider
public void rollback(TransactionContext ctx)
rollback
in interface TransactionProvider
Copyright © 2017. All Rights Reserved.