Package org.dalesbred.integration.spring
Class SpringTransactionManager
- java.lang.Object
-
- org.dalesbred.integration.spring.SpringTransactionManager
-
- All Implemented Interfaces:
TransactionManager
public final class SpringTransactionManager extends java.lang.Object implements TransactionManager
ConnectionProvider
which integrates with Spring's transaction management.Usually application code should not need this class, but use
DalesbredConfigurationSupport
to integrate with Spring.
-
-
Constructor Summary
Constructors Constructor Description SpringTransactionManager(@NotNull javax.sql.DataSource dataSource, @NotNull PlatformTransactionManager platformTransactionManager)
Constructs new SpringTransactionManager to use.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasActiveTransaction()
Returns true if the code is executing inside transaction.<T> T
withCurrentTransaction(@NotNull TransactionCallback<T> callback, @NotNull Dialect dialect)
Executes given callback within current transaction.<T> T
withTransaction(@NotNull TransactionSettings settings, @NotNull TransactionCallback<T> callback, @NotNull Dialect dialect)
Executes given callback with given transaction settings.
-
-
-
Constructor Detail
-
SpringTransactionManager
public SpringTransactionManager(@NotNull @NotNull javax.sql.DataSource dataSource, @NotNull @NotNull PlatformTransactionManager platformTransactionManager)
Constructs new SpringTransactionManager to use.
-
-
Method Detail
-
withCurrentTransaction
public <T> T withCurrentTransaction(@NotNull @NotNull TransactionCallback<T> callback, @NotNull @NotNull Dialect dialect)
Description copied from interface:TransactionManager
Executes given callback within current transaction.- Specified by:
withCurrentTransaction
in interfaceTransactionManager
-
withTransaction
public <T> T withTransaction(@NotNull @NotNull TransactionSettings settings, @NotNull @NotNull TransactionCallback<T> callback, @NotNull @NotNull Dialect dialect)
Description copied from interface:TransactionManager
Executes given callback with given transaction settings.- Specified by:
withTransaction
in interfaceTransactionManager
-
hasActiveTransaction
public boolean hasActiveTransaction()
Description copied from interface:TransactionManager
Returns true if the code is executing inside transaction.- Specified by:
hasActiveTransaction
in interfaceTransactionManager
-
-