Class SqlSessionTxAdvice

java.lang.Object
com.aspectran.mybatis.SqlSessionTxAdvice

public class SqlSessionTxAdvice extends Object
Advice for SqlSession Transactions.
Since:
2015. 04. 03.
Author:
Juho Jeong
  • Constructor Summary

    Constructors
    Constructor
    Description
    SqlSessionTxAdvice(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the session.
    void
    close(boolean arbitrarily)
    Closes the session.
    void
    Flushes batch statements and commits database connection.
    void
    commit(boolean force)
    Flushes batch statements and commits database connection.
    org.apache.ibatis.session.ExecutorType
     
    org.apache.ibatis.session.SqlSession
    Returns an open SqlSession.
    boolean
    Returns whether the session was logically closed in user code, not by the framework.
    boolean
     
    void
    Opens a new SqlSession and store its instance inside.
    void
    open(boolean autoCommit)
     
    void
    open(String executorType)
     
    void
    open(String executorType, boolean autoCommit)
     
    void
    open(org.apache.ibatis.session.ExecutorType executorType, boolean autoCommit)
     
    void
    Discards pending batch statements and rolls database connection back.
    void
    rollback(boolean force)
    Discards pending batch statements and rolls database connection back.
    void
    setAutoCommit(boolean autoCommit)
    Specifies whether to auto-commit.
    void
    setExecutorType(String executorType)
    Sets the mode for using PreparedStatements effectively.
    void
    setExecutorType(org.apache.ibatis.session.ExecutorType executorType)
    Sets the mode for using PreparedStatements effectively.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SqlSessionTxAdvice

      public SqlSessionTxAdvice(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)
  • Method Details

    • isAutoCommit

      public boolean isAutoCommit()
    • setAutoCommit

      public void setAutoCommit(boolean autoCommit)
      Specifies whether to auto-commit.
      Parameters:
      autoCommit - true to automatically commit each time updates/deletes/inserts is called, false to commit manually
    • getExecutorType

      public org.apache.ibatis.session.ExecutorType getExecutorType()
    • setExecutorType

      public void setExecutorType(org.apache.ibatis.session.ExecutorType executorType)
      Sets the mode for using PreparedStatements effectively.
      Parameters:
      executorType - executor types include SIMPLE, REUSE, and BATCH
    • setExecutorType

      public void setExecutorType(String executorType)
      Sets the mode for using PreparedStatements effectively.
      Parameters:
      executorType - executor types include SIMPLE, REUSE, and BATCH, and can be specified as a string value
    • getSqlSession

      public org.apache.ibatis.session.SqlSession getSqlSession()
      Returns an open SqlSession. If no SqlSession is open then return null.
      Returns:
      a SqlSession instance
    • open

      public void open()
      Opens a new SqlSession and store its instance inside. Therefore, whenever there is a request for a SqlSessionTxAdvice bean, a new bean instance of the object must be created.
    • open

      public void open(boolean autoCommit)
    • open

      public void open(String executorType)
    • open

      public void open(org.apache.ibatis.session.ExecutorType executorType, boolean autoCommit)
    • open

      public void open(String executorType, boolean autoCommit)
    • commit

      public void commit()
      Flushes batch statements and commits database connection. Note that database connection will not be committed if no updates/deletes/inserts were called. To force the commit, call commit(boolean).
    • commit

      public void commit(boolean force)
      Flushes batch statements and commits database connection.
      Parameters:
      force - forces connection commit
    • rollback

      public void rollback()
      Discards pending batch statements and rolls database connection back. Note that database connection will not be rolled back if no updates/deletes/inserts were called. To force the rollback, call rollback(boolean).
    • rollback

      public void rollback(boolean force)
      Discards pending batch statements and rolls database connection back. Note that database connection will not be rolled back if no updates/deletes/inserts were called.
      Parameters:
      force - forces connection rollback
    • close

      public void close()
      Closes the session.
    • close

      public void close(boolean arbitrarily)
      Closes the session.
      Parameters:
      arbitrarily - true if the session is arbitrarily closed by user code, false otherwise
    • isArbitrarilyClosed

      public boolean isArbitrarilyClosed()
      Returns whether the session was logically closed in user code, not by the framework.
      Returns:
      true if the session was closed by user code, false otherwise