org.mybatis.spring.transaction
Class SpringManagedTransaction

java.lang.Object
  extended by org.mybatis.spring.transaction.SpringManagedTransaction
All Implemented Interfaces:
org.apache.ibatis.transaction.Transaction

public class SpringManagedTransaction
extends Object
implements org.apache.ibatis.transaction.Transaction

SpringManagedTransaction handles the lifecycle of a JDBC connection. It retrieves a connection from Spring's transaction manager and returns it back to it when it is no longer needed.

If Spring's transaction handling is active it will no-op all commit/rollback/close calls assuming that the Spring transaction manager will do the job.

If it is not it will behave like JdbcTransaction.

Version:
$Id: SpringManagedTransaction.java 4887 2012-03-12 10:01:34Z simone.tripodi $

Constructor Summary
SpringManagedTransaction(DataSource dataSource)
           
 
Method Summary
 void close()
          
 void commit()
          
 Connection getConnection()
          
 void rollback()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringManagedTransaction

public SpringManagedTransaction(DataSource dataSource)
Method Detail

getConnection

public Connection getConnection()
                         throws SQLException

Specified by:
getConnection in interface org.apache.ibatis.transaction.Transaction
Throws:
SQLException

commit

public void commit()
            throws SQLException

Specified by:
commit in interface org.apache.ibatis.transaction.Transaction
Throws:
SQLException

rollback

public void rollback()
              throws SQLException

Specified by:
rollback in interface org.apache.ibatis.transaction.Transaction
Throws:
SQLException

close

public void close()
           throws SQLException

Specified by:
close in interface org.apache.ibatis.transaction.Transaction
Throws:
SQLException


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