java.lang.Object
org.mybatis.spring.transaction.SpringManagedTransaction
- All Implemented Interfaces:
org.apache.ibatis.transaction.Transaction
public class SpringManagedTransaction
extends java.lang.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.
- Author:
- Hunter Presnall, Eduardo Macarron
-
Constructor Summary
Constructors Constructor Description SpringManagedTransaction(javax.sql.DataSource dataSource) -
Method Summary
Modifier and Type Method Description voidclose()voidcommit()java.sql.ConnectiongetConnection()java.lang.IntegergetTimeout()voidrollback()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
SpringManagedTransaction
public SpringManagedTransaction(javax.sql.DataSource dataSource)
-
-
Method Details
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException- Specified by:
getConnectionin interfaceorg.apache.ibatis.transaction.Transaction- Throws:
java.sql.SQLException
-
commit
public void commit() throws java.sql.SQLException- Specified by:
commitin interfaceorg.apache.ibatis.transaction.Transaction- Throws:
java.sql.SQLException
-
rollback
public void rollback() throws java.sql.SQLException- Specified by:
rollbackin interfaceorg.apache.ibatis.transaction.Transaction- Throws:
java.sql.SQLException
-
close
public void close() throws java.sql.SQLException- Specified by:
closein interfaceorg.apache.ibatis.transaction.Transaction- Throws:
java.sql.SQLException
-
getTimeout
public java.lang.Integer getTimeout() throws java.sql.SQLException- Specified by:
getTimeoutin interfaceorg.apache.ibatis.transaction.Transaction- Throws:
java.sql.SQLException
-