Package org.dalesbred.transaction
Class SingleConnectionTransactionManager
- java.lang.Object
-
- org.dalesbred.transaction.AbstractTransactionManager
-
- org.dalesbred.transaction.SingleConnectionTransactionManager
-
- All Implemented Interfaces:
TransactionManager
public final class SingleConnectionTransactionManager extends AbstractTransactionManager
ATransactionManager
that uses single underlyingConnection
. Can be used to construct aDatabase
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
Constructors Constructor Description SingleConnectionTransactionManager(@NotNull java.sql.Connection connection, boolean insideForeignTransaction)
Constructs a transaction manager that uses given connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected @NotNull java.util.Optional<org.dalesbred.transaction.DefaultTransaction>
getActiveTransaction()
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 Detail
-
SingleConnectionTransactionManager
public SingleConnectionTransactionManager(@NotNull @NotNull java.sql.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 Detail
-
getActiveTransaction
@NotNull protected @NotNull java.util.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
-
-