org.apache.cayenne.tx

## Interface TransactionManager

- All Known Implementing Classes:
    DefaultTransactionManager

      public interface TransactionManager

  An optional utility service that simplifies wrapping multiple operations in transactions. Users only rarely need to invoke it directly, as all standard Cayenne operations are managing their own transactions internally.
  Since:
    4.0

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> T` | `performInTransaction(TransactionalOperation<T> op)` Starts a new transaction (or joins an existing one) calling `TransactionalOperation.perform()`, and then committing or rolling back the transaction.
    `<T> T` | `performInTransaction(TransactionalOperation<T> op, TransactionListener callback)` Starts a new transaction (or joins an existing one) calling `TransactionalOperation.perform()`, and then committing or rolling back the transaction.

- - ### Method Detail

    - #### performInTransaction

          <T> T performInTransaction(TransactionalOperation<T> op)

      Starts a new transaction (or joins an existing one) calling `TransactionalOperation.perform()`, and then committing or rolling back the transaction.
      Parameters:
        `op` - an operation to perform within the trsnaction.
      Returns:
        a value returned by the "op" operation.

    - #### performInTransaction

          <T> T performInTransaction(TransactionalOperation<T> op,
                                     TransactionListener callback)

      Starts a new transaction (or joins an existing one) calling `TransactionalOperation.perform()`, and then committing or rolling back the transaction. As transaction goes through stages, callback methods are invoked allowing the caller to customize transaction parameters.
      Parameters:
        `op` - an operation to perform within the trsnaction.
        `callback` - a callback to notify as transaction progresses through stages.
      Returns:
        a value returned by the "op" operation.

Copyright © 2001–2023 Apache Cayenne. All rights reserved.