1、SqlSession :經常使用接口SqlSession。實現java.io.Closeable。java
主要集成了sql
一、查詢類函數 selectXXX數據庫
二、插入類函數insertXXXapache
三、刪除類函數delete緩存
四、事務提交commitsession
五、回滾rollbackapp
六、批量更新flushStatements函數
七、session緩存刪除clearCache接口
八、獲取配置getConfiguration事務
九、根據類別獲取數據庫操做Mapper函數getMapper(Class<T> type);
十、數據庫鏈接獲取getConnection
3、SqlSessionFactory
SqlSession的工廠類,主要集成打開會話獲取session函數和獲取配置Configuration 的函數
多態函數:不一樣的入參獲取對應類型的SqlSession
SqlSession openSession(boolean autoCommit) ,
SqlSession openSession(Connection connection);
SqlSession openSession(TransactionIsolationLevel level);
SqlSession openSession(ExecutorType execType);
SqlSession openSession(ExecutorType execType, boolean autoCommit);
SqlSession openSession(ExecutorType execType, TransactionIsolationLevel level);
SqlSession openSession(ExecutorType execType, Connection connection);
4、ExecutorType執行類型
枚舉類 SIMPLE(簡單), REUSE(重用), BATCH(批處理)
mybaties對sqlsession和sqlsessionFactory的默認實如今org.apache.ibatis.session.defaults中。開發者能夠自定義擴展sqlsession。
DefaultSqlSession