Mybatis中的Executor(策略模式)
抽象统一接口:Excutor
适配器:BaseExecutor
不同的实现策略:SimpleExecutor | BatchExecutor | CachingExecutor | ClosedExecutor | ReuseExecutor
- SimpleExecutor 普通的执行器
- ReuseExecutor 重用预处理语句(PreparedStatement)
- BatchExecutor 重用预处理语句(PreparedStatement)且 执行批量更新
package org.apache.ibatis.executor;
import java.sql.SQLException;
import java.util.List;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.cursor.Cursor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.transaction.Transaction;
public interface Executor {
ResultHandler NO_RESULT_HANDLER = null;
int update(MappedStatement var1,Object var2) throws SQLException;
<E> List<E> query(MappedStatement var1,Object var2,RowBounds var3,ResultHandler var4,CacheKey var5,BoundSql var6) throws SQLException;
<E> List<E> query(MappedStatement var1,Object var2,RowBounds var3,ResultHandler var4) throws SQLException;
<E> Cursor<E> queryCursor();
}