Interface TransactionOperations<T>

Type Parameters:
T - The resource type, such as the connection.
All Known Subinterfaces:
MongoTransactionOperations, SynchronousTransactionManager<T>
All Known Implementing Classes:
AbstractDefaultTransactionOperations, AbstractPropagatedStatusTransactionOperations, AbstractSpringTransactionOperations, AbstractTransactionOperations, DataSourceTransactionManager, HibernateTransactionManager, SpringHibernateTransactionOperations, SpringJdbcTransactionOperations, SynchronousTransactionOperationsFromReactiveTransactionOperations

public interface TransactionOperations<T>
Generic transaction operations interface.
Since:
1.0.0
Author:
graemerocher
  • Method Details

    • getConnection

      @NonNull T getConnection()
      Obtains the connection for the current transaction.
      Returns:
      The connection
      Throws:
      NoTransactionException - if no connection exists for the current transaction
    • hasConnection

      boolean hasConnection()
      Check if the connection exists.
      Returns:
      True if transaction exists
      Since:
      3.3
    • findTransactionStatus

      Optional<? extends TransactionStatus<?>> findTransactionStatus()
      Find optional propagated transaction status.
      Returns:
      The transaction status.
    • execute

      <R> R execute(@NonNull @NonNull TransactionDefinition definition, @NonNull @NonNull TransactionCallback<T,R> callback)
      Execute a transaction within the context of the function.
      Type Parameters:
      R - The result
      Parameters:
      definition - The transaction definition
      callback - The call back
      Returns:
      The result
    • executeRead

      default <R> R executeRead(@NonNull @NonNull TransactionCallback<T,R> callback)
      Execute a read-only transaction within the context of the function.
      Type Parameters:
      R - The result
      Parameters:
      callback - The call back
      Returns:
      The result
    • executeWrite

      default <R> R executeWrite(@NonNull @NonNull TransactionCallback<T,R> callback)
      Execute a default transaction within the context of the function.
      Type Parameters:
      R - The result
      Parameters:
      callback - The call back
      Returns:
      The result