Class StatementLogSqlSession

  • All Implemented Interfaces:
    Closeable, AutoCloseable, org.apache.ibatis.session.SqlSession

    public class StatementLogSqlSession
    extends DelegatingSqlSession

    This SqlSession wraps an actual SqlSession and logs executed sql statements. (Calls to the delete*, update*, select*, insert* methods.)

    Author:
    Daniel Meyer
    • Constructor Detail

      • StatementLogSqlSession

        public StatementLogSqlSession​(org.apache.ibatis.session.SqlSession wrappedSession)
    • Method Detail

      • delete

        public int delete​(String statement)
        Specified by:
        delete in interface org.apache.ibatis.session.SqlSession
        Overrides:
        delete in class DelegatingSqlSession
      • delete

        public int delete​(String statement,
                          Object parameter)
        Specified by:
        delete in interface org.apache.ibatis.session.SqlSession
        Overrides:
        delete in class DelegatingSqlSession
      • insert

        public int insert​(String statement)
        Specified by:
        insert in interface org.apache.ibatis.session.SqlSession
        Overrides:
        insert in class DelegatingSqlSession
      • insert

        public int insert​(String statement,
                          Object paremeter)
        Specified by:
        insert in interface org.apache.ibatis.session.SqlSession
        Overrides:
        insert in class DelegatingSqlSession
      • update

        public int update​(String statement)
        Specified by:
        update in interface org.apache.ibatis.session.SqlSession
        Overrides:
        update in class DelegatingSqlSession
      • update

        public int update​(String statement,
                          Object parameter)
        Specified by:
        update in interface org.apache.ibatis.session.SqlSession
        Overrides:
        update in class DelegatingSqlSession
      • select

        public void select​(String statement,
                           Object parameter,
                           org.apache.ibatis.session.ResultHandler handler)
        Specified by:
        select in interface org.apache.ibatis.session.SqlSession
        Overrides:
        select in class DelegatingSqlSession
      • select

        public void select​(String statement,
                           Object parameter,
                           org.apache.ibatis.session.RowBounds rowBounds,
                           org.apache.ibatis.session.ResultHandler handler)
        Specified by:
        select in interface org.apache.ibatis.session.SqlSession
        Overrides:
        select in class DelegatingSqlSession
      • select

        public void select​(String statement,
                           org.apache.ibatis.session.ResultHandler handler)
        Specified by:
        select in interface org.apache.ibatis.session.SqlSession
        Overrides:
        select in class DelegatingSqlSession
      • selectList

        public <E> List<E> selectList​(String statement,
                                      Object parameter,
                                      org.apache.ibatis.session.RowBounds rowBounds)
        Specified by:
        selectList in interface org.apache.ibatis.session.SqlSession
        Overrides:
        selectList in class DelegatingSqlSession
      • selectMap

        public <K,​V> Map<K,​V> selectMap​(String statement,
                                                    Object parameter,
                                                    String mapKey,
                                                    org.apache.ibatis.session.RowBounds rowBounds)
        Specified by:
        selectMap in interface org.apache.ibatis.session.SqlSession
        Overrides:
        selectMap in class DelegatingSqlSession
      • selectOne

        public <T> T selectOne​(String statement)
        Specified by:
        selectOne in interface org.apache.ibatis.session.SqlSession
        Overrides:
        selectOne in class DelegatingSqlSession
      • selectOne

        public <T> T selectOne​(String statement,
                               Object parameter)
        Specified by:
        selectOne in interface org.apache.ibatis.session.SqlSession
        Overrides:
        selectOne in class DelegatingSqlSession
      • startLogging

        public static void startLogging()
        starts logging any statements executed by the calling thread.