|
|||||||||
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 java.util.Map |
connections
|
protected TransactionDelegate |
delegate
|
protected org.apache.log4j.Level |
logLevel
Deprecated. since 1.2 |
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 | |
---|---|
void |
addConnection(java.sql.Connection connection)
Deprecated. since 1.2 use addConnection(String, Connection) . |
boolean |
addConnection(java.lang.String name,
java.sql.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. |
java.sql.Connection |
getConnection(java.lang.String name)
|
TransactionDelegate |
getDelegate()
|
org.apache.log4j.Level |
getLogLevel()
Deprecated. since 1.2 unused |
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. |
void |
performQueries(QueryEngine engine,
java.util.Collection queries,
OperationObserver observer)
Deprecated. since 1.2 this method is not used in Cayenne and is deprecated. Thread-bound transactions should be used instead. |
abstract void |
rollback()
|
void |
setDelegate(TransactionDelegate delegate)
|
void |
setLogLevel(org.apache.log4j.Level logLevel)
Deprecated. since 1.2 unused |
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 java.util.Map connections
protected int status
protected TransactionDelegate delegate
protected org.apache.log4j.Level logLevel
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 void performQueries(QueryEngine engine, java.util.Collection queries, OperationObserver observer) throws CayenneRuntimeException
CayenneRuntimeException
public org.apache.log4j.Level getLogLevel()
public void setLogLevel(org.apache.log4j.Level logLevel)
public TransactionDelegate getDelegate()
public void setDelegate(TransactionDelegate delegate)
public int getStatus()
public void setRollbackOnly()
public void setStatus(int status)
public abstract void begin()
public void addConnection(java.sql.Connection connection) throws java.lang.IllegalStateException, java.sql.SQLException, CayenneException
addConnection(String, Connection)
.
java.lang.IllegalStateException
java.sql.SQLException
CayenneException
public abstract void commit() throws java.lang.IllegalStateException, java.sql.SQLException, CayenneException
java.lang.IllegalStateException
java.sql.SQLException
CayenneException
public abstract void rollback() throws java.lang.IllegalStateException, java.sql.SQLException, CayenneException
java.lang.IllegalStateException
java.sql.SQLException
CayenneException
public java.sql.Connection getConnection(java.lang.String name)
public boolean addConnection(java.lang.String name, java.sql.Connection connection) throws java.sql.SQLException
java.sql.SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |