public abstract class Transaction extends Object
Modifier and Type | Field and Description |
---|---|
protected Map<String,Connection> |
connections |
protected TransactionDelegate |
delegate |
protected JdbcEventLogger |
jdbcEventLogger |
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 |
Modifier | Constructor and Description |
---|---|
protected |
Transaction()
Creates new inactive transaction.
|
Modifier and Type | Method and Description |
---|---|
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() |
JdbcEventLogger |
getJdbcEventLogger() |
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 |
setJdbcEventLogger(JdbcEventLogger jdbcEventLogger) |
void |
setRollbackOnly() |
void |
setStatus(int status) |
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<String,Connection> connections
protected int status
protected TransactionDelegate delegate
protected JdbcEventLogger jdbcEventLogger
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 setJdbcEventLogger(JdbcEventLogger jdbcEventLogger)
public JdbcEventLogger getJdbcEventLogger()
public void setRollbackOnly()
public void setStatus(int status)
public abstract void begin()
public abstract void commit() throws IllegalStateException, SQLException, CayenneException
public abstract void rollback() throws IllegalStateException, SQLException, CayenneException
public Connection getConnection(String name)
public boolean addConnection(String name, Connection connection) throws SQLException
SQLException
Copyright © 2001–2018 Apache Cayenne. All rights reserved.