Class 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.

    Author:
    Hunter Presnall, Eduardo Macarron
    • 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
      • getTimeout

        public Integer getTimeout()
                           throws SQLException
        Specified by:
        getTimeout in interface org.apache.ibatis.transaction.Transaction
        Throws:
        SQLException