Package org.dalesbred.integration.spring
Class SpringTransactionManager
java.lang.Object
org.dalesbred.integration.spring.SpringTransactionManager
- All Implemented Interfaces:
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
ConstructorDescriptionSpringTransactionManager
(@NotNull DataSource dataSource, @NotNull PlatformTransactionManager platformTransactionManager) Constructs new SpringTransactionManager to use. -
Method Summary
Modifier and TypeMethodDescriptionboolean
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 Details
-
SpringTransactionManager
public SpringTransactionManager(@NotNull @NotNull DataSource dataSource, @NotNull @NotNull PlatformTransactionManager platformTransactionManager) Constructs new SpringTransactionManager to use.
-
-
Method Details
-
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
-