ExternalTransaction (cayenne-doc: Cayenne Documentation 5.0-M2 API)
Description: declaration: package: org.apache.cayenne.tx, class: ExternalTransaction

# Class ExternalTransaction

java.lang.Object
org.apache.cayenne.tx.BaseTransaction
org.apache.cayenne.tx.ExternalTransaction

All Implemented Interfaces:
  `Transaction`

public class ExternalTransaction extends BaseTransaction
Represents a container-managed transaction.

Since:
  4.0

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected JdbcEventLogger`
  `logger`

  ### Fields inherited from class BaseTransaction

  `connections, defaultIsolationLevel, descriptor, listeners, status, STATUS_ACTIVE, STATUS_COMMITTED, STATUS_COMMITTING, STATUS_MARKED_ROLLEDBACK, STATUS_NO_TRANSACTION, STATUS_ROLLEDBACK, STATUS_ROLLING_BACK`
  Modifier and Type
  Field
  Description
  `protected Map<String, Connection>`
  `connections`
  `protected int`
  `defaultIsolationLevel`
  `protected TransactionDescriptor`
  `descriptor`
  `protected Collection<TransactionListener>`
  `listeners`
  `protected int`
  `status`
  `protected static final int`
  `STATUS_ACTIVE`
  `protected static final int`
  `STATUS_COMMITTED`
  `protected static final int`
  `STATUS_COMMITTING`
  `protected static final int`
  `STATUS_MARKED_ROLLEDBACK`
  `protected static final int`
  `STATUS_NO_TRANSACTION`
  `protected static final int`
  `STATUS_ROLLEDBACK`
  `protected static final int`
  `STATUS_ROLLING_BACK`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ExternalTransaction(JdbcEventLogger jdbcEventLogger)`
  `ExternalTransaction(JdbcEventLogger jdbcEventLogger, TransactionDescriptor descriptor)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `isExternal()`
  Is this transaction managed by external transaction manager
  `protected void`
  `processCommit()`
  `protected void`
  `processRollback()`

  ### Methods inherited from class BaseTransaction

  `addConnection, addListener, begin, bindThreadTransaction, close, commit, connectionAdded, getConnections, getExistingConnection, getOrCreateConnection, getThreadTransaction, isRollbackOnly, rollback, setRollbackOnly`
  Modifier and Type
  Method
  Description
  `protected Connection`
  `addConnection(String connectionName, Connection connection)`
  `void`
  `addListener(TransactionListener listener)`
  `void`
  `begin()`
  Starts a Transaction.
  `static void`
  `bindThreadTransaction(Transaction transaction)`
  Binds a Transaction to the current thread.
  `protected void`
  `close()`
  Closes all connections associated with transaction.
  `void`
  `commit()`
  `protected void`
  `connectionAdded(Connection connection)`
  `Map<String, Connection>`
  `getConnections()`
  Returns all connections associated with the transaction.
  `protected Connection`
  `getExistingConnection(String name)`
  `Connection`
  `getOrCreateConnection(String connectionName, DataSource dataSource)`
  Retrieves a connection for the given symbolic name.
  `static Transaction`
  `getThreadTransaction()`
  Returns a Transaction associated with the current thread, or null if there is no such Transaction.
  `boolean`
  `isRollbackOnly()`
  `void`
  `rollback()`
  `void`
  `setRollbackOnly()`

  ### Methods inherited from class Object

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

- ## Field Details

  - ### logger

    protected JdbcEventLogger logger

- ## Constructor Details

  - ### ExternalTransaction

    public ExternalTransaction(JdbcEventLogger jdbcEventLogger)

  - ### ExternalTransaction

    public ExternalTransaction(JdbcEventLogger jdbcEventLogger, TransactionDescriptor descriptor)
    Since:
      4.1

- ## Method Details

  - ### processCommit

    protected void processCommit()
    Specified by:
      `processCommit` in class `BaseTransaction`

  - ### processRollback

    protected void processRollback()
    Specified by:
      `processRollback` in class `BaseTransaction`

  - ### isExternal

    public boolean isExternal()
    Description copied from interface: `Transaction`
    Is this transaction managed by external transaction manager