public abstract class BaseTransaction extends Object implements Transaction
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Connection> |
connections |
protected Collection<TransactionListener> |
listeners |
protected int |
status |
protected static int |
STATUS_ACTIVE |
protected static int |
STATUS_COMMITTED |
protected static int |
STATUS_COMMITTING |
protected static int |
STATUS_MARKED_ROLLEDBACK |
protected static int |
STATUS_NO_TRANSACTION |
protected static int |
STATUS_ROLLEDBACK |
protected static int |
STATUS_ROLLING_BACK |
| Modifier | Constructor and Description |
|---|---|
protected |
BaseTransaction()
Creates new inactive transaction.
|
| Modifier and Type | Method and Description |
|---|---|
void |
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) |
Connection |
getConnection(String name) |
static Transaction |
getThreadTransaction()
Returns a Transaction associated with the current thread, or null if
there is no such Transaction.
|
boolean |
isRollbackOnly() |
protected abstract void |
processCommit() |
protected abstract void |
processRollback() |
void |
rollback() |
void |
setRollbackOnly() |
protected static final int STATUS_ACTIVE
protected static final int STATUS_COMMITTING
protected static final int STATUS_COMMITTED
protected static final int STATUS_ROLLEDBACK
protected static final int STATUS_ROLLING_BACK
protected static final int STATUS_NO_TRANSACTION
protected static final int STATUS_MARKED_ROLLEDBACK
protected Map<String,Connection> connections
protected Collection<TransactionListener> listeners
protected int status
public static void bindThreadTransaction(Transaction transaction)
public static Transaction getThreadTransaction()
public void setRollbackOnly()
setRollbackOnly in interface Transactionpublic boolean isRollbackOnly()
isRollbackOnly in interface Transactionpublic void addListener(TransactionListener listener)
addListener in interface Transactionpublic void begin()
begin in interface Transactionpublic void commit()
commit in interface Transactionprotected abstract void processCommit()
public void rollback()
rollback in interface Transactionprotected abstract void processRollback()
public Connection getConnection(String name)
getConnection in interface Transactionpublic void addConnection(String connectionName, Connection connection)
addConnection in interface Transactionprotected void connectionAdded(Connection connection)
protected void close()
Copyright © 2001–2016 Apache Cayenne. All rights reserved.