|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.access.Transaction
public abstract class Transaction
A Cayenne transaction. Currently supports managing JDBC connections.
Field Summary | |
---|---|
protected Map |
connections
|
protected TransactionDelegate |
delegate
|
protected int |
status
|
static int |
STATUS_ACTIVE
|
static int |
STATUS_COMMITTED
|
static int |
STATUS_COMMITTING
|
static int |
STATUS_MARKED_ROLLEDBACK
|
static int |
STATUS_NO_TRANSACTION
|
static int |
STATUS_ROLLEDBACK
|
static int |
STATUS_ROLLING_BACK
|
Constructor Summary | |
---|---|
protected |
Transaction()
Creates new inactive transaction. |
Method Summary | |
---|---|
boolean |
addConnection(String name,
Connection connection)
|
abstract void |
begin()
Starts a Transaction. |
static void |
bindThreadTransaction(Transaction transaction)
Binds a Transaction to the current thread. |
abstract void |
commit()
|
static Transaction |
externalTransaction(TransactionDelegate delegate)
Factory method returning a new transaction instance that would NOT propagate commit/rollback to participating connections. |
Connection |
getConnection(String name)
|
TransactionDelegate |
getDelegate()
|
int |
getStatus()
|
static Transaction |
getThreadTransaction()
Returns a Transaction associated with the current thread, or null if there is no such Transaction. |
static Transaction |
internalTransaction(TransactionDelegate delegate)
Factory method returning a new transaction instance that would propagate commit/rollback to participating connections. |
static Transaction |
noTransaction()
Factory method returning a transaction instance that does not alter the state of participating connections in any way. |
abstract void |
rollback()
|
void |
setDelegate(TransactionDelegate delegate)
|
void |
setRollbackOnly()
|
void |
setStatus(int status)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int STATUS_ACTIVE
public static final int STATUS_COMMITTING
public static final int STATUS_COMMITTED
public static final int STATUS_ROLLEDBACK
public static final int STATUS_ROLLING_BACK
public static final int STATUS_NO_TRANSACTION
public static final int STATUS_MARKED_ROLLEDBACK
protected Map connections
protected int status
protected TransactionDelegate delegate
Constructor Detail |
---|
protected Transaction()
Method Detail |
---|
public static void bindThreadTransaction(Transaction transaction)
public static Transaction getThreadTransaction()
public static Transaction internalTransaction(TransactionDelegate delegate)
public static Transaction externalTransaction(TransactionDelegate delegate)
public static Transaction noTransaction()
public TransactionDelegate getDelegate()
public void setDelegate(TransactionDelegate delegate)
public int getStatus()
public void setRollbackOnly()
public void setStatus(int status)
public abstract void begin()
public abstract void commit() throws IllegalStateException, SQLException, CayenneException
IllegalStateException
SQLException
CayenneException
public abstract void rollback() throws IllegalStateException, SQLException, CayenneException
IllegalStateException
SQLException
CayenneException
public Connection getConnection(String name)
public boolean addConnection(String name, Connection connection) throws SQLException
SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |