Interface Transaction

All Known Implementing Classes:
SimpleTransaction

public interface Transaction
Access and manipulation of a currently-active transaction.
  • Method Details

    • connection

      Connection connection()
      Returns:
      The connection for the transaction.
    • context

      default <T> T context()
      Type Parameters:
      T - The context type. Coerced on read.
      Returns:
      A TransactionManager-specific object representing the context of this transaction. Intended for use with TransactionManager implementations that support explicitly-passed transaction context injection into method arguments.
    • prepareBatchStatement

      PreparedStatement prepareBatchStatement(String sql)
      Creates a prepared statement which will be cached and re-used within a transaction. Any batch on these statements is executed before the transaction is committed, and automatically closed.
      Parameters:
      sql - The SQL statement
      Returns:
      The statement.
    • addPostCommitHook

      void addPostCommitHook(Runnable runnable)
      Will be called to perform work immediately after the current transaction is committed. This should occur in the same thread and will generally not be long-lasting.
      Parameters:
      runnable - The code to run post-commit.