Class ManagedTransaction
- java.lang.Object
- 
- org.apache.ibatis.transaction.managed.ManagedTransaction
 
- 
- All Implemented Interfaces:
- Transaction
 
 public class ManagedTransaction extends java.lang.Object implements Transaction Transactionthat lets the container manage the full lifecycle of the transaction. Delays connection retrieval until getConnection() is called. Ignores all commit or rollback requests. By default, it closes the connection but can be configured not to do it.- Author:
- Clinton Begin
- See Also:
- ManagedTransactionFactory
 
- 
- 
Constructor SummaryConstructors Constructor Description ManagedTransaction(java.sql.Connection connection, boolean closeConnection)ManagedTransaction(javax.sql.DataSource ds, TransactionIsolationLevel level, boolean closeConnection)
 - 
Method SummaryModifier and Type Method Description voidclose()Close inner database connection.voidcommit()Commit inner database connection.java.sql.ConnectiongetConnection()Retrieve inner database connection.java.lang.IntegergetTimeout()Get transaction timeout if set.protected voidopenConnection()voidrollback()Rollback inner database connection.
 
- 
- 
- 
Constructor Detail- 
ManagedTransactionpublic ManagedTransaction(java.sql.Connection connection, boolean closeConnection)
 - 
ManagedTransactionpublic ManagedTransaction(javax.sql.DataSource ds, TransactionIsolationLevel level, boolean closeConnection)
 
- 
 - 
Method Detail- 
getConnectionpublic java.sql.Connection getConnection() throws java.sql.SQLExceptionDescription copied from interface:TransactionRetrieve inner database connection.- Specified by:
- getConnectionin interface- Transaction
- Returns:
- DataBase connection
- Throws:
- java.sql.SQLException
 
 - 
commitpublic void commit() throws java.sql.SQLExceptionDescription copied from interface:TransactionCommit inner database connection.- Specified by:
- commitin interface- Transaction
- Throws:
- java.sql.SQLException
 
 - 
rollbackpublic void rollback() throws java.sql.SQLExceptionDescription copied from interface:TransactionRollback inner database connection.- Specified by:
- rollbackin interface- Transaction
- Throws:
- java.sql.SQLException
 
 - 
closepublic void close() throws java.sql.SQLExceptionDescription copied from interface:TransactionClose inner database connection.- Specified by:
- closein interface- Transaction
- Throws:
- java.sql.SQLException
 
 - 
openConnectionprotected void openConnection() throws java.sql.SQLException- Throws:
- java.sql.SQLException
 
 - 
getTimeoutpublic java.lang.Integer getTimeout() throws java.sql.SQLExceptionDescription copied from interface:TransactionGet transaction timeout if set.- Specified by:
- getTimeoutin interface- Transaction
- Throws:
- java.sql.SQLException
 
 
- 
 
-