MyBatis User Guide.rar
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
- 1
- 粉丝: 409
- 资源: 1万+
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助