Skip to content

Mybatis -3.3.x 源码分析-中文记录每一步的微妙操作

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE
Unknown
license.txt
Notifications You must be signed in to change notification settings

zhangxiangfeng/myabtis-source-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MYBATIS Data Mapper Framework

Build Status Maven central Apache 2

mybatis

The MyBatis data mapper framework makes it easier to use a relational database with object-oriented applications. MyBatis couples objects with stored procedures or SQL statements using a XML descriptor or annotations. Simplicity is the biggest advantage of the MyBatis data mapper over object relational mapping tools.

MyBatis数据映射器框架使关系数据库与面向对象的应用程序的使用变得更加容易。 MyBatis使用XML描述符或注释将对象与存储过程或SQL语句结合在一起。 简单性是MyBatis数据映射器相对于对象关系映射工具的最大优势。

Essentials


0.起步

Reader reader = Resources.getResourceAsReader("cn/openread/test/simple/xml/MapperConfig.xml");

SqlSession sqlSession = SqlSessionManager.newInstance(reader).openSession();

AccountMapper accountMapper = sqlSession.getMapper(AccountMapper.class);

List<Account> accounts = accountMapper.selectAll();

log.debug("查询结果:" + JSON.toJSONString(accounts));

1.深入分析起步读取

分析下面这一句

Reader reader = Resources.getResourceAsReader("cn/openread/test/simple/xml/MapperConfig.xml");

2.深入分析创建SqlSession

分析下面这一句

SqlSession sqlSession = SqlSessionManager.newInstance(reader).openSession();

3.深入执行接口获取

分析下面这一句

AccountMapper accountMapper = sqlSession.getMapper(AccountMapper.class);

4.深入分析SQL结果执行和收集

分析下面这一句

List<Account> accounts = accountMapper.selectAll();

About

Mybatis -3.3.x 源码分析-中文记录每一步的微妙操作

Resources

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE
Unknown
license.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages