|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.torque.util.Transaction
public final class Transaction
Encapsulates transaction and connection handling within Torque. If the underlying database does not support transaction or the database pool returns autocommit connections, the commit and rollback methods fallback to simple connection pool handling.
Method Summary | |
---|---|
static Connection |
begin()
Begin a transaction by retrieving a connection from the default database connection pool. |
static Connection |
begin(String dbName)
Begin a transaction by retrieving a connection from the named database connection pool. |
static void |
commit(Connection con)
Commit a transaction and close the connection. |
static void |
rollback(Connection con)
Roll back a transaction and release the connection. |
static void |
safeRollback(Connection con)
Roll back a transaction without throwing errors if they occur. |
static void |
setTransactionManager(TransactionManager transactionManager)
Sets the transaction manager to use. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void setTransactionManager(TransactionManager transactionManager)
transactionManager
- the transaction manager to use.public static Connection begin() throws TorqueException
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static Connection begin(String dbName) throws TorqueException
dbName
- Name of database.
TorqueException
- If the connection cannot be retrieved.public static void commit(Connection con) throws TorqueException
con
- The Connection for the transaction.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static void rollback(Connection con) throws TorqueException
con
- The Connection for the transaction.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static void safeRollback(Connection con)
con
- The Connection for the transaction.rollback(Connection)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |