Package 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 | 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, TransactionDescriptor descriptor)` | Performs operation in a transaction which parameters described by descriptor.
    `<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.
    `<T> T` | `performInTransaction​(TransactionalOperation<T> op, TransactionListener callback, TransactionDescriptor descriptor)` | Performs operation in a transaction which parameters described by descriptor.

- - ### 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.
      Type Parameters:
        `T` - returned value type
      Parameters:
        `op` - an operation to perform within the transaction.
      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.
      Type Parameters:
        `T` - returned value type
      Parameters:
        `op` - an operation to perform within the transaction.
        `callback` - a callback to notify as transaction progresses through stages.
      Returns:
        a value returned by the "op" operation.

    - #### performInTransaction

          <T> T performInTransaction​(TransactionalOperation<T> op,
                                     TransactionDescriptor descriptor)

      Performs operation in a transaction which parameters described by descriptor.
      Type Parameters:
        `T` - result type
      Parameters:
        `op` - an operation to perform within the transaction.
        `descriptor` - transaction descriptor
      Returns:
        a value returned by the "op" operation.
      Since:
        4.1

    - #### performInTransaction

          <T> T performInTransaction​(TransactionalOperation<T> op,
                                     TransactionListener callback,
                                     TransactionDescriptor descriptor)

      Performs operation in a transaction which parameters described by descriptor. As transaction goes through stages, callback methods are invoked allowing the caller to customize transaction parameters.
      Type Parameters:
        `T` - returned value type
      Parameters:
        `op` - an operation to perform within the transaction.
        `callback` - a callback to notify as transaction progresses through stages.
        `descriptor` - transaction descriptor
      Returns:
        a value returned by the "op" operation.
      Since:
        4.1