Package migratedb.v1.core.internal.jdbc
Class TransactionalExecutionTemplate
- java.lang.Object
-
- migratedb.v1.core.internal.jdbc.TransactionalExecutionTemplate
-
- All Implemented Interfaces:
ExecutionTemplate
- Direct Known Subclasses:
CockroachRetryingTransactionalExecutionTemplate
public class TransactionalExecutionTemplate extends Object implements ExecutionTemplate
Spring-like template for executing transactions.
-
-
Constructor Summary
Constructors Constructor Description TransactionalExecutionTemplate(Connection connection, boolean rollbackOnException)Creates a new transaction template for this connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Texecute(Callable<T> callback)Executes this callback within a transaction.
-
-
-
Constructor Detail
-
TransactionalExecutionTemplate
public TransactionalExecutionTemplate(Connection connection, boolean rollbackOnException)
Creates a new transaction template for this connection.- Parameters:
connection- The connection for the transaction.rollbackOnException- Whether to roll back the transaction when an exception is thrown.
-
-
Method Detail
-
execute
public <T> T execute(Callable<T> callback)
Executes this callback within a transaction.- Specified by:
executein interfaceExecutionTemplate- Parameters:
callback- The callback to execute.- Returns:
- The result of the transaction code.
-
-