Package org.apache.torque.util
Klasse TransactionManagerImpl
java.lang.Object
org.apache.torque.util.TransactionManagerImpl
- Alle implementierten Schnittstellen:
TransactionManager
Standard connection and transaction management for Torque.
Uses JDBC connection operations and Torque's own database pools
for managing connections and transactions.
- Version:
- $Id: TransactionManagerImpl.java 1917245 2024-04-21 14:06:23Z tv $
- Autor:
- Stephen Haberman
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungbegin()
Begin a transaction by retrieving a connection from the default database connection pool.Begin a transaction by retrieving a connection from the named database connection pool.void
commit
(Connection con) Commit a transaction and close the connection.void
rollback
(Connection con) Roll back a transaction and release the connection.void
safeRollback
(Connection con) Roll back a transaction without throwing errors if they occur.
-
Konstruktordetails
-
TransactionManagerImpl
public TransactionManagerImpl()
-
-
Methodendetails
-
begin
Begin a transaction by retrieving a connection from the default database connection pool. WARNING: If the database does not support transaction or the pool has set autocommit to true on the connection, the database will commit after every statement, regardless of when a commit or rollback is issued.- Angegeben von:
begin
in SchnittstelleTransactionManager
- Gibt zurück:
- The Connection for the transaction.
- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
begin
Begin a transaction by retrieving a connection from the named database connection pool. WARNING: If the database does not support transaction or the pool has set autocommit to true on the connection, the database will commit after every statement, regardless of when a commit or rollback is issued.- Angegeben von:
begin
in SchnittstelleTransactionManager
- Parameter:
dbName
- Name of database.- Gibt zurück:
- The Connection for the transaction.
- Löst aus:
TorqueException
- If the connection cannot be retrieved.
-
commit
Commit a transaction and close the connection. If the connection is in autocommit mode or the database does not support transactions, only a connection close is performed- Angegeben von:
commit
in SchnittstelleTransactionManager
- Parameter:
con
- The Connection for the transaction.- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
rollback
Roll back a transaction and release the connection. In databases that do not support transactions or if autocommit is true, no rollback will be performed, but the connection will be closed anyway.- Angegeben von:
rollback
in SchnittstelleTransactionManager
- Parameter:
con
- The Connection for the transaction.- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
safeRollback
Roll back a transaction without throwing errors if they occur. A null Connection argument is logged at the debug level and other errors are logged at warn level.- Angegeben von:
safeRollback
in SchnittstelleTransactionManager
- Parameter:
con
- The Connection for the transaction.- Siehe auch:
-