org.apache.ibatis.transaction.managed
Class ManagedTransaction

java.lang.Object
  extended by org.apache.ibatis.transaction.managed.ManagedTransaction
All Implemented Interfaces:
Transaction

public class ManagedTransaction
extends Object
implements Transaction

Transaction that 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.

See Also:
ManagedTransactionFactory

Constructor Summary
ManagedTransaction(Connection connection, boolean closeConnection)
           
ManagedTransaction(DataSource ds, TransactionIsolationLevel level, boolean closeConnection)
           
 
Method Summary
 void close()
          Close inner database connection.
 void commit()
          Commit inner database connection.
 Connection getConnection()
          Retrieve inner database connection
protected  void openConnection()
           
 void rollback()
          Rollback inner database connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagedTransaction

public ManagedTransaction(Connection connection,
                          boolean closeConnection)

ManagedTransaction

public ManagedTransaction(DataSource ds,
                          TransactionIsolationLevel level,
                          boolean closeConnection)
Method Detail

getConnection

public Connection getConnection()
                         throws SQLException
Description copied from interface: Transaction
Retrieve inner database connection

Specified by:
getConnection in interface Transaction
Returns:
DataBase connection
Throws:
SQLException

commit

public void commit()
            throws SQLException
Description copied from interface: Transaction
Commit inner database connection.

Specified by:
commit in interface Transaction
Throws:
SQLException

rollback

public void rollback()
              throws SQLException
Description copied from interface: Transaction
Rollback inner database connection.

Specified by:
rollback in interface Transaction
Throws:
SQLException

close

public void close()
           throws SQLException
Description copied from interface: Transaction
Close inner database connection.

Specified by:
close in interface Transaction
Throws:
SQLException

openConnection

protected void openConnection()
                       throws SQLException
Throws:
SQLException


Copyright © 2010-2012 MyBatis.org. All Rights Reserved.