public final class Transaction extends Object
Modifier and Type | Method and Description |
---|---|
static TorqueConnection |
begin()
Begin a transaction by retrieving a connection from the default database
connection pool.
|
static TorqueConnection |
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 TransactionManager |
getTransactionManager()
Returns the current transaction manager.
|
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.
|
public static void setTransactionManager(TransactionManager transactionManager)
transactionManager
- the transaction manager to use.public static TransactionManager getTransactionManager()
public static TorqueConnection begin() throws TorqueException
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static TorqueConnection 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)
Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.