img
Introducing MyBatis
iBATIS, the old name of MyBatis, was started by Clinton Begin in 2001, with the project code donated to
Apache Software Foundation (ASF) in 2004. Based on its SQL mapping focus, simple infrastructure, and
easy-to-understand mapping definitions from SQL queries to the Java OO model, iBATIS gained
popularity quickly and became one of the most used data access libraries in the Java developer
community.
After staying in ASF for six years, the iBATIS development team realized that data-accessing
technologies in the open source world had changed dramatically. Consequently, the team decided to
introduce numerous significant changes into the library. Starting with version 3, the project also
changed its name to MyBatis, left ASF, and became an independent open source framework. The iBATIS
project at ASF was also retired. At the time of this writing, the current version of MyBatis is 3.0.6.
Before Spring 3.0, Spring had out-of-the-box support for iBATIS version 2. However, because of the
difficulties in synchronizing the massive changes from iBATIS 2 to MyBatis 3 with the Spring framework,
Spring's development team decided to drop the built-in support of MyBatis.
To deal with this situation, the MyBatis team has started the MyBatis Spring Integration Project
(called mybatis-spring). At the time of this writing, the current version of mybatis-spring is 1.0.2.
Creating a Simple Utility Project with MyBatis Support in STS
In STS, there is no template project provided for using Spring with MyBatis, so we need to create a
simple Spring utility project in STS and then add the required dependencies manually. First create a
simple Spring utility project in STS (please refer to Appendix A for details). Double-check that the project
is using JSE 6 and Spring 3.1.
Upon project creation, open the pom.xml file in the POM editor and add the dependencies listed in
Table 11-1.
Table 11-1. Maven Dependencies for Spring with MyBatis
Group ID
Artifact ID
Version
Description
3.1.0.RELEASE Spring library for JDBC access, which is required
org.springframework spring-jdbc
by all applications with data access logic
3.1.0.RELEASE Spring library required for transaction support.
org.springframework spring-tx
1.3.160
H2 database library for embedded database
com.h2database
h2
support
3.0.6
MyBatis core library
org.mybatis
mybatis
1.0.2
MyBatis with Spring integration library
org.mybatis
mybatis-spring
Figure 11-1 shows STS with the Maven dependencies after all the dependencies have been defined.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home