Introduction: IBATIS is a project that is primarily used for data access objects (both the information accessing Object,dao) and Object Relational mappings (Object-relational mapping,orm). You can use it to easily work with Java™ objects and databases. The update on IBATIS 3 Beta 9 was released on January 23, 2010. IBATIS 3 is a fully rewritten version of IBATIS and includes some significant updates. This article will introduce some of the new features in IBATIS 3.
If you have not been writing Java code for a short time, you may recall the days when you wrote many classes containing logical methods that map data within a Java object to data within a relational database management system (RDBMS) or from data within an RDBMS to Java The data within the object. Now, for the most part, this kind of human intervention is not encouraged, but it is recommended that you use ORM tools as a best practice.
The ORM tool allows you to configure the mapping between data elements within a relational database and Java object properties. Once configured, these tools allow you to secure the use of Java objects without worrying about how the data in the Java class's properties is stored or retrieved, freeing you from writing, debugging, and error handling from a large number of repetitive code.
This article describes the new features in IBATIS 3, and IBATIS 3 is an ORM tool from Apache Foundation that can be used to build Java applications that connect to the database. To maximize the use of this article, it is recommended that you use the Java Development Kit (JDK) V5 or later version; Eclipse V3.4 or later. This article uses the IBATIS 3 beta 9. The IBATIS site indicates that the Beta 9 is very close to the generic version (GA), so the examples in this article should apply to GA versions when GA versions are available.
Since the primary purpose of IBATIS is to map the RDBMS, a database is also needed to get the full picture of these examples. This example in this article chooses to use Apache Derby as a database. It's worth noting that, in addition to freeing you from writing repetitive Java code that uses Java Database Connectivity (JDBC), the other advantage of ORM tools is the ability to provide better data-layer abstraction. With just a little change to the IBATIS configuration and a reference to the correct JDBC library, you can use the examples in this article for other databases.
IBATIS Overview
IBATIS 3 is a persistent framework that you can use to configure the mappings between the properties of Java classes and the table columns within the RDBMS. When configured, this framework is responsible for handling JDBC connections and allocations. You can configure IBATIS 3 with an XML file. IBATIS can be downloaded from the IBATIS site in a compressed archive (Zip) format. Within this archive is a Java Archive (JAR) file that can be included within a Java object to provide the required classes.