Class 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
      void close()
      void commit()
      java.sql.Connection getConnection()
      java.lang.Integer getTimeout()
      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​(javax.sql.DataSource dataSource)
    • Method Detail

      • getConnection

        public java.sql.Connection getConnection()
                                          throws java.sql.SQLException
        Specified by:
        getConnection in interface org.apache.ibatis.transaction.Transaction
        Throws:
        java.sql.SQLException
      • commit

        public void commit()
                    throws java.sql.SQLException
        Specified by:
        commit in interface org.apache.ibatis.transaction.Transaction
        Throws:
        java.sql.SQLException
      • rollback

        public void rollback()
                      throws java.sql.SQLException
        Specified by:
        rollback in interface org.apache.ibatis.transaction.Transaction
        Throws:
        java.sql.SQLException
      • close

        public void close()
        Specified by:
        close in interface org.apache.ibatis.transaction.Transaction
      • getTimeout

        public java.lang.Integer getTimeout()
        Specified by:
        getTimeout in interface org.apache.ibatis.transaction.Transaction