mybatis一次查询过程的分析二

MappedStatement ms = configuration.getMappedStatement(statement);
这句就是根据statement的id获取MappedStatement。这里的executor是在创建sqlsession的是否创建的,在sqlsessionfactory,看DefaultSqlSessionFactory中的openSession方法
有很多的重载方法
在这里插入图片描述
最终都会走到configuration中newExecutor方法
在这里插入图片描述
protected boolean cacheEnabled = true;
最终我们拿到手的是CachingExecutor,这个类主要是处理二级缓存的,一级缓存在后面会说
在这里插入图片描述
直接看query方法
在这里插入图片描述
这节先到这,下一节先分析TransactionalCacheManager这个类,才能看懂缓存逻辑。

猜你喜欢

转载自blog.csdn.net/zhenghuangyu/article/details/86723622
今日推荐