分类分类
大小:486 KB更新:2011/05/06
类别:JAVA教程系统:PDF
MyBatis is a first class persistence framework with support for custom SQL, stored procedures and advanced mappings. MyBatis eliminates almost all of the JDBC code and manual setting of parameters and retrieval of results. MyBatis can use simple XML or Annotations for configuration and map primitives, Map interfaces and Java POJOs (Plain Old Java Objects) to database records.
Contents
What is MyBatis? .. 5
Getting Started ...... 5
Building SqlSessionFactory from XML ............. 5
Building SqlSessionFactory without XML ........ 6
Acquiring a SqlSession from SqlSessionFactory ............. 6
Exploring Mapped SQL Statements . 7
A Note about Namespaces........... 8
Scope and Lifecycle .......... 9
Mapper Configuration XML 10
properties ........ 11
settings ............ 12
typeAliases ...... 13
typeHandlers ... 14
objectFactory .. 15
plugins ............. 16
environments .. 17
transactionManager .... 18
dataSource .. 19
mappers .......... 21
SQL Map XML Files ............. 21
select 22
insert, update, delete ...... 24
sql ..... 26
Parameters ...... 26
MyBatis 3 - User Guide
5 November 2010 4
resultMap ........ 28
Advanced Result Mapping ......... 30
id, result ...... 32
Supported JDBC Types 33
constructor .. 33
association .. 34
collection ..... 37
discriminator .............. 40
cache 41
Using a Custom Cache . 43
cache-ref ......... 44
Dynamic SQL ....... 44
if ....... 44
choose, when, otherwise 45
trim, where, set .............. 45
foreach ............ 47
Java API 49
Directory Structure ........ 49
SqlSessions ...... 50
SqlSessionFactoryBuilder ........... 50
SqlSessionFactory....... 52
SqlSession .... 54
SelectBuilder ....... 60
SqlBuilder ............ 63