|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.torque.util.Transaction
Refactored begin/commit/rollback transaction methods away from
the BasePeer
.
This can be used to handle cases where transaction support is optional. The second parameter of beginOptionalTransaction will determine with a transaction is used or not. If a transaction is not used, the commit and rollback methods do not have any effect. Instead it simply makes the logic easier to follow by cutting down on the if statements based solely on whether a transaction is needed or not.
Field Summary | |
private static org.apache.log4j.Category |
category
The log. |
Constructor Summary | |
Transaction()
|
Method Summary | |
static java.sql.Connection |
begin(java.lang.String dbName)
Begin a transaction. |
static java.sql.Connection |
beginOptional(java.lang.String dbName,
boolean useTransaction)
Begin a transaction. |
static void |
commit(java.sql.Connection con)
Commit a transaction. |
static void |
rollback(java.sql.Connection con)
Roll back a transaction in databases that support transactions. |
static void |
safeRollback(java.sql.Connection con)
Roll back a transaction without throwing errors if they occur. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static org.apache.log4j.Category category
Constructor Detail |
public Transaction()
Method Detail |
public static java.sql.Connection begin(java.lang.String dbName) throws TorqueException
dbName
- Name of database.
TorqueException
public static java.sql.Connection beginOptional(java.lang.String dbName, boolean useTransaction) throws TorqueException
dbName
- Name of database.useTransaction
- If false, a transaction won't be used.
TorqueException
public static void commit(java.sql.Connection con) throws TorqueException
con
- The Connection for the transaction.
TorqueException
public static void rollback(java.sql.Connection con) throws TorqueException
con
- The Connection for the transaction.
TorqueException
public static void safeRollback(java.sql.Connection con)
con
- The Connection for the transaction.safeRollback
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |