Package org.apache.cayenne.tx
Interface Transaction
- All Known Implementing Classes:
- BaseTransaction,- CayenneTransaction,- ExternalTransaction
public interface Transaction
Cayenne Transaction interface.
- Since:
- 4.0
- 
Method SummaryModifier and Type Method Description voidaddListener(TransactionListener listener)voidbegin()Starts a Transaction.voidcommit()Map<String,Connection>getConnections()Returns all connections associated with the transaction.ConnectiongetOrCreateConnection(String connectionName, DataSource dataSource)Retrieves a connection for the given symbolic name.booleanisExternal()Is this transaction managed by external transaction managerbooleanisRollbackOnly()voidrollback()voidsetRollbackOnly()
- 
Method Details- 
beginvoid begin()Starts a Transaction. If Transaction is not started explicitly, it will be started when the first connection is added.
- 
commitvoid commit()
- 
rollbackvoid rollback()
- 
setRollbackOnlyvoid setRollbackOnly()
- 
isRollbackOnlyboolean isRollbackOnly()
- 
getOrCreateConnectionRetrieves a connection for the given symbolic name. If it does not exists, creates a new connection using provided DataSource, and registers it internally.- Parameters:
- connectionName- a symbolic name of the connection. Cayenne DataNodes generate a name in the form of "DataNode.Connection.nodename".
- dataSource- DataSource that provides new connections.
- Returns:
- a connection that participates in the current transaction.
- Throws:
- SQLException
 
- 
getConnectionsMap<String,Connection> getConnections()Returns all connections associated with the transaction.- Returns:
- connections associated with the transaction.
 
- 
addListener
- 
isExternalboolean isExternal()Is this transaction managed by external transaction manager
 
-