Package org.apache.cayenne.tx

## Class TransactionDescriptor

- java.lang.Object
- - org.apache.cayenne.tx.TransactionDescriptor

- Direct Known Subclasses:
    `DefaultTransactionDescriptor`

      public class TransactionDescriptor
      extends Object

  Descriptor that allows to customize transaction logic. It provides following options:
  - transaction isolation level
  - transaction propagation logic.
  - custom connection to use in a transaction
  Since:
    4.1
  See Also:
    `TransactionManager.performInTransaction(TransactionalOperation, TransactionDescriptor)`, `ServerRuntime.performInTransaction(TransactionalOperation, TransactionDescriptor)`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `TransactionDescriptor.Builder` | Builder class for the TransactionDescriptor.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `ISOLATION_DEFAULT` | Keep database default isolation level

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TransactionDescriptor​(int isolation)` | Deprecated. since 4.2.
    `TransactionDescriptor​(int isolation, TransactionPropagation propagation)` | Deprecated. since 4.2.
    `TransactionDescriptor​(TransactionPropagation propagation)` | Deprecated. since 4.2.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static TransactionDescriptor.Builder` | `builder()` |
    `Supplier<Connection>` | `getConnectionSupplier()` |
    `int` | `getIsolation()` |
    `TransactionPropagation` | `getPropagation()` |

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### ISOLATION_DEFAULT

          public static final int ISOLATION_DEFAULT

      Keep database default isolation level
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TransactionDescriptor

          @Deprecated
          public TransactionDescriptor​(int isolation,
                                       TransactionPropagation propagation)

      Deprecated.
      since 4.2. Use `builder()` method instead.
      Parameters:
        `isolation` - one of the following `Connection` constants: `Connection.TRANSACTION_READ_UNCOMMITTED`, `Connection.TRANSACTION_READ_COMMITTED`, `Connection.TRANSACTION_REPEATABLE_READ`, `Connection.TRANSACTION_SERIALIZABLE`, or `TransactionDescriptor.ISOLATION_DEFAULT`
        `propagation` - transaction propagation behaviour
      See Also:
        `TransactionPropagation`

    - #### TransactionDescriptor

          @Deprecated
          public TransactionDescriptor​(int isolation)

      Deprecated.
      since 4.2. Use `builder()` method instead.
      Create transaction descriptor with desired isolation level and `NESTED` propagation
      Parameters:
        `isolation` - one of the following `Connection` constants: `Connection.TRANSACTION_READ_UNCOMMITTED`, `Connection.TRANSACTION_READ_COMMITTED`, `Connection.TRANSACTION_REPEATABLE_READ`, `Connection.TRANSACTION_SERIALIZABLE`, or `TransactionDescriptor.ISOLATION_DEFAULT`

    - #### TransactionDescriptor

          @Deprecated
          public TransactionDescriptor​(TransactionPropagation propagation)

      Deprecated.
      since 4.2. Use `builder()` method instead.
      Parameters:
        `propagation` - transaction propagation behaviour
      See Also:
        `TransactionPropagation`

  - ### Method Detail

    - #### getIsolation

          public int getIsolation()

      Returns:
        required isolation level

    - #### getPropagation

          public TransactionPropagation getPropagation()

      Returns:
        required propagation behaviour

    - #### getConnectionSupplier

          public Supplier<Connection> getConnectionSupplier()

      Returns:
        custom connection supplier, passed by user

    - #### builder

          public static TransactionDescriptor.Builder builder()