写在前面
与hibernate相比,我无疑更喜欢mybatis,就因为我觉得它真的好用,哈哈。它简单上手和掌握;sql语句和代码分开,方便统一管理和优化;当然缺点也有:sql工作量很大,尤其是字段多、关联表多时,更是如此。而且sql依赖于数据库,导致数据库移植性差。
选用一个框架之前最好先了解它的优缺点,对项目最好用,效率最高的才是一个你最好的选择。
mybatis简介
MyBatis 是支持普通 SQL查询,存储过程和高级映射的优秀持久层框架。MyBatis 消除了几乎所有的JDBC代码和参数的手工设置以及结果集的检索。MyBatis 使用简单的 XML或注解用于配置和原始映射,将接口和 Java 的POJOs(Plain Old Java Objects,普通的 Java对象)映射成数据库中的记录。
直接上思维导图
![](http://upload-images.jianshu.io/upload_images/4120002-8593f17572d1a1b9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
1、mybatis简介.png
![](http://upload-images.jianshu.io/upload_images/4120002-fe73ae40aeece93e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
2、与hibernate对比.png
![](http://upload-images.jianshu.io/upload_images/4120002-f131762ecb72c537.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
3、几个关键类.png
![](http://upload-images.jianshu.io/upload_images/4120002-311188b2fe96bcfb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
4、mybatis执行浅析.png
![](http://upload-images.jianshu.io/upload_images/4120002-73d661f80a541035.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
5、MyBatis框架整体设计.png
![](http://upload-images.jianshu.io/upload_images/4120002-246e53dd4b65312d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
6、mybatis初始化与执行sql过程.png
![](http://upload-images.jianshu.io/upload_images/4120002-445accca274c6124.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
7、mybatis源码的几个主要部件.png
![](http://upload-images.jianshu.io/upload_images/4120002-c7163b1ffc62e35a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
8、XML 映射配置文件(一).png
![](http://upload-images.jianshu.io/upload_images/4120002-b8b3d8d93a5048fd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
9、XML 映射配置文件(二).png
![](http://upload-images.jianshu.io/upload_images/4120002-1510493422f6f274.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
10、XML 映射配置文件(三).png
作者:java思维导图
链接:http://www.jianshu.com/p/06b73e8d9f56
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。