# Class DefaultTransactionManager

java.lang.Object
org.apache.cayenne.tx.DefaultTransactionManager

All Implemented Interfaces:
  `TransactionManager`

public class DefaultTransactionManager extends Object implements TransactionManager

Since:
  4.0

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `protected static class`
  `DefaultTransactionManager.BaseTransactionHandler`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultTransactionManager(TransactionFactory txFactory)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected DefaultTransactionManager.BaseTransactionHandler`
  `getHandler(TransactionDescriptor descriptor)`
  `<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, TransactionFactory transactionFactory)`
  Performs an operation in a transaction created by the supplied factory, instead of the configured one.
  `<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.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### DefaultTransactionManager

    public DefaultTransactionManager(TransactionFactory txFactory)

- ## Method Details

  - ### performInTransaction

    public <T> T performInTransaction(TransactionalOperation<T> op)
    Description copied from interface: `TransactionManager`
    Starts a new transaction (or joins an existing one) calling `TransactionalOperation.perform()`, and then committing or rolling back the transaction.
    Specified by:
      `performInTransaction` in interface `TransactionManager`
    Type Parameters:
      `T` - returned value type
    Parameters:
      `op` - an operation to perform within the transaction.
    Returns:
      a value returned by the "op" operation.

  - ### performInTransaction

    public <T> T performInTransaction(TransactionalOperation<T> op, TransactionListener callback)
    Description copied from interface: `TransactionManager`
    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.
    Specified by:
      `performInTransaction` in interface `TransactionManager`
    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

    public <T> T performInTransaction(TransactionalOperation<T> op, TransactionDescriptor descriptor)
    Description copied from interface: `TransactionManager`
    Performs operation in a transaction which parameters described by descriptor.
    Specified by:
      `performInTransaction` in interface `TransactionManager`
    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

    public <T> T performInTransaction(TransactionalOperation<T> op, TransactionListener callback, TransactionDescriptor descriptor)
    Description copied from interface: `TransactionManager`
    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.
    Specified by:
      `performInTransaction` in interface `TransactionManager`
    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

  - ### performInTransaction

    public <T> T performInTransaction(TransactionalOperation<T> op, TransactionFactory transactionFactory)
    Description copied from interface: `TransactionManager`
    Performs an operation in a transaction created by the supplied factory, instead of the configured one. This lets callers run an operation in a special transaction, such as a `ReadOnlyTransaction`. Behaves like `TransactionPropagation.NESTED` - joining an existing transaction if one is bound, otherwise creating a new one from the given factory.
    Specified by:
      `performInTransaction` in interface `TransactionManager`
    Type Parameters:
      `T` - returned value type
    Parameters:
      `op` - an operation to perform within the transaction.
      `transactionFactory` - a factory for the transaction to run the operation in.
    Returns:
      a value returned by the "op" operation.
    Since:
      5.0

  - ### getHandler

    protected DefaultTransactionManager.BaseTransactionHandler getHandler(TransactionDescriptor descriptor)