# Interface TransactionListener

public interface TransactionListener
A callback that is notified as transaction progresses through stages. It can customize transaction isolation level, etc.

Since:
  4.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default Connection`
  `decorateConnection(Transaction tx, Connection connection)`
  This method could be used to decorate or substitute new connection initiated inside a Cayenne transaction.
  `void`
  `willAddConnection(Transaction tx, String connectionName, Connection connection)`
  `void`
  `willCommit(Transaction tx)`
  `void`
  `willRollback(Transaction tx)`

- ## Method Details

  - ### willCommit

    void willCommit(Transaction tx)

  - ### willRollback

    void willRollback(Transaction tx)

  - ### willAddConnection

    void willAddConnection(Transaction tx, String connectionName, Connection connection)

  - ### decorateConnection

    default Connection decorateConnection(Transaction tx, Connection connection)
    This method could be used to decorate or substitute new connection initiated inside a Cayenne transaction.
    The default implementation returns the same connection.
    Parameters:
      `tx` - transaction that initiated connection
      `connection` - connection (it could be decorated by other listeners)
    Returns:
      connection
    Since:
      4.2