《mybatis-spring-1.0.0-reference》.pdf
文本预览下载声明
MyBatis-Spring 1.0.0 - Reference Documentation
The MyBatis Community (MyB)
Copyright © 2010
Copies of this document may be made for your own use and for distribution to others, provided that you do not
charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether
distributed in print or electronically.
1. Introduction 1
1.1. What is MyBatis-Spring? 1
1.2. Motivation 1
1.3. Requirements 1
1.4. Acknowledgements 1
2. Getting Started 2
2.1. Installation 2
2.2. Quick Setup 2
3. SqlSessionFactoryBean 4
3.1. Setup 4
3.2. Properties 4
4. Transactions 6
4.1. Standard Configuration 6
4.2. Container Managed Transactions 6
4.3. Programmatic Transaction Management 7
5. Using an SqlSession 8
5.1. SqlSessionTemplate 8
5.2. SqlSessionDaoSupport 9
6. Injecting Mappers 10
6.1. MapperFactoryBean 10
6.2. MapperScannerConfigurer 11
7. Using the MyBatis API 12
8. Sample Code 13
ii
Chapter 1. Introduction
1.1. What is MyBatis-Spring?
MyBatis-Spring helps you integrate your MyBatis code seamlessly with Spring. Using the classes in this
library, Spring will load the necessary MyBatis factory and session classes for you. This library also provides
an easy way to inject MyBatis data mappers and SqlSessions into your service beans. It will also handle
transactions and translate MyBatis exceptions into Spring DataAccessExceptions. Finally, it will let you build
your application code free of dependencies on MyBatis, Spring or MyBatis-Spring.
1.2
显示全部