读书人

关于mybatis里头的Executor

发布时间: 2012-09-22 21:54:54 作者: rapoo

关于mybatis里面的Executor
使用mybatis查寻数据,跟踪其执行流程

最开始执行的语句

  public Executor newExecutor(Transaction transaction, ExecutorType executorType, boolean autoCommit) {    executorType = executorType == null ? defaultExecutorType : executorType;    executorType = executorType == null ? ExecutorType.SIMPLE : executorType;    Executor executor;    if (ExecutorType.BATCH == executorType) {      executor = new BatchExecutor(this, transaction);    } else if (ExecutorType.REUSE == executorType) {      executor = new ReuseExecutor(this, transaction);    } else {      executor = new SimpleExecutor(this, transaction);    }    if (cacheEnabled) {      executor = new CachingExecutor(executor, autoCommit);    }    executor = (Executor) interceptorChain.pluginAll(executor);    return executor;  }

CachingExecutor可以使mybatis先从缓存中提取数据,数据缓存中没有数据时才从数据库里面提取数据

读书人网 >软件架构设计

热点推荐