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 Details

    • 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 Details

    • execute

      public <T> T execute(Callable<T> callback)
      Executes this callback within a transaction.
      Specified by:
      execute in interface ExecutionTemplate
      Parameters:
      callback - The callback to execute.
      Returns:
      The result of the transaction code.