Package org.dalesbred.transaction
Class SingleConnectionTransactionManager
java.lang.Object
org.dalesbred.transaction.AbstractTransactionManager
org.dalesbred.transaction.SingleConnectionTransactionManager
- All Implemented Interfaces:
TransactionManager
A
TransactionManager
that uses single underlying Connection
.
Can be used to construct a Database
with limited functionality
in situations where we need to use a specific connection (i.e. integration with third-party
frameworks that provide callbacks with just a connection).-
Constructor Summary
ConstructorDescriptionSingleConnectionTransactionManager
(@NotNull Connection connection, boolean insideForeignTransaction) Constructs a transaction manager that uses given connection. -
Method Summary
Modifier and TypeMethodDescriptionprotected @NotNull Optional<org.dalesbred.transaction.DefaultTransaction>
protected <T> T
withNewTransaction
(@NotNull TransactionCallback<T> callback, @NotNull Dialect dialect, @NotNull Isolation isolation) protected <T> T
withSuspendedTransaction
(@NotNull TransactionCallback<T> callback, @NotNull Isolation isolation, @NotNull Dialect dialect) Methods inherited from class org.dalesbred.transaction.AbstractTransactionManager
hasActiveTransaction, withCurrentTransaction, withTransaction
-
Constructor Details
-
SingleConnectionTransactionManager
public SingleConnectionTransactionManager(@NotNull @NotNull Connection connection, boolean insideForeignTransaction) Constructs a transaction manager that uses given connection.- Parameters:
connection
- to use for database accessinsideForeignTransaction
- true iff transaction manager should assume that calls are inside a transactional context provided by third party framework
-
-
Method Details
-
getActiveTransaction
@NotNull protected @NotNull Optional<org.dalesbred.transaction.DefaultTransaction> getActiveTransaction()- Specified by:
getActiveTransaction
in classAbstractTransactionManager
-
withNewTransaction
protected <T> T withNewTransaction(@NotNull @NotNull TransactionCallback<T> callback, @NotNull @NotNull Dialect dialect, @NotNull @NotNull Isolation isolation) - Specified by:
withNewTransaction
in classAbstractTransactionManager
-
withSuspendedTransaction
protected <T> T withSuspendedTransaction(@NotNull @NotNull TransactionCallback<T> callback, @NotNull @NotNull Isolation isolation, @NotNull @NotNull Dialect dialect) - Specified by:
withSuspendedTransaction
in classAbstractTransactionManager
-