随笔分类 - Mybatis源码分析
Mybatis源码分析
摘要:之前单独使用Mybatis的时候,是用SqlSession得到一个mapper然后调用mapper里面对应的方法就可以得到数据库中的数据。 代码如下: public static void main(String[] args) throws IOException { String resourc
阅读全文
摘要:前面说过mybatis是靠Executor来执行sql的,Executor的类型又分了三种。 public enum ExecutorType { SIMPLE, REUSE, BATCH } 默认是SIMPLE这一种。可以在全局配置文件中通过下面配置改变 <settings> <setting n
阅读全文
摘要:先来看下使用: 打印sql语句和执行的时间 1:实现 Interceptor 接口 @Intercepts({ @Signature(type = StatementHandler.class, method = "prepare", args = { Connection.class, Integ
阅读全文
摘要:使用Mybatis 1:全局配置文件:mybatis-config.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "htt
阅读全文
摘要:源码编译下载: https://github.com/mybatis/mybatis-3 https://github.com/mybatis/parent(依赖) Mybatis源码袭来parent工程。需要先编译parent工程再编译mybatis,具体如下 解决parent依赖问题: 在构建的
阅读全文