MyBatis の SqlSessionFactory

SqlSession session = new SqlSessionFactoryBuilder()
   .build(Resources.getResourceAsReader("mybatis-config.xml"))
   .openSession();

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);

だいたい引数無しを使うことが多い
TransactionIsolationLevel : トランザクション分離レベルを指定

NONE       トランザクション無効
READ_UNCOMMITTED ダーティリード有 ファジーリード有 ファントムリード有
READ_COMMITTED  ダーティリード無 ファジーリード有 ファントムリード有
REPEATABLE_READ ダーティリード無 ファジーリード無 ファントムリード有
SERIALIZABLE   ダーティリード無 ファジーリード無 ファントムリード無

ダーティリード:トランザクションが更新されている最中に、他のトランザクションからデータを読み出すことができる
ファジーリード: トランザクションでUPDATEされたレコードを読み込んでしまう
ファントムリード: トランザクションでINSERTされたレコードを読み込んでしまう

ExecutorType

SIMPLE デフォルト ステートメント実行のたびにPreparedStatementを作成します。
REUSE PreparedStatementを再利用します。
BATCH 更新ステートメントバッチ処理します。