1 / 104
目录
简介 .......................................................................................................................................... 3
什么是 MyBatis? ............................................................................................................ 3
Help make this documentation better… ....................................................................... 3
入门........................................................................................................................................... 3
Installation ......................................................................................................................... 3
从 XML 中构建 SqlSessionFactory .............................................................................. 3
不使用 XML 构建 SqlSessionFactory .......................................................................... 5
从 SqlSessionFactory 中获取 SqlSession ...................................................................... 5
探究已映射的 SQL 语句 ............................................................................................... 6
范围和生命周期 ............................................................................................................... 8
XML 映射配置文件 .............................................................................................................. 10
properties ....................................................................................................................... 11
settings ............................................................................................................................ 12
typeAliases ..................................................................................................................... 16
typeHandlers.................................................................................................................. 19
Handling Enums ............................................................................................................ 23
objectFactory ................................................................................................................. 26
plugins ............................................................................................................................ 27
environments ................................................................................................................. 29
databaseIdProvider ....................................................................................................... 33
mappers .......................................................................................................................... 34
Mapper XML 文件 ................................................................................................................ 35
select ............................................................................................................................... 35
insert, update and delete .................................................................................................. 38
sql .................................................................................................................................... 43
Parameters ....................................................................................................................... 43
Result Maps..................................................................................................................... 45
Auto-mapping ................................................................................................................. 68
缓存 ................................................................................................................................. 70
动态 SQL .............................................................................................................................. 73
if ...................................................................................................................................... 73
choose, when, otherwise ................................................................................................ 74
trim, where, set .............................................................................................................. 75
foreach ............................................................................................................................ 78
bind ................................................................................................................................. 79
Multi-db vendor support .............................................................................................. 79
Pluggable Scripting Languages For Dynamic SQL ................................................... 80
Java API ................................................................................................................................. 81
应用目录结构 ................................................................................................................. 81
SqlSessions...................................................................................................................... 82
Statement Builders ............................................................................................................ 95