Jump to content

Apache iBATIS

From Alfawiki
iBATIS
Company typeOpen source software framework
IndustrySoftware development
Founded2001
FounderClinton Begin
DefunctJune 16, 2010 (2010-06-16)
FateArchived in Apache Attic; development forked to MyBatis
Area served
Worldwide
ProductsPersistence framework for Java, .NET, and Ruby on Rails

iBATIS is a persistence framework designed to streamline the mapping process between SQL databases and objects in Java, .NET, and Ruby on Rails environments. In the Java ecosystem, it facilitates mapping to POJOs (Plain Old Java Objects). The SQL queries are maintained externally within XML configuration files, minimizing the amount of code developers must write to interact with relational databases through APIs such as JDBC and ODBC.

In contrast to frameworks like Hibernate, which generate and control database schemas based on object models, iBATIS operates by leveraging an existing SQL database and automating the generation of corresponding Java objects. This methodology is particularly advantageous when developers do not have full authority over the database schema—common in cases involving legacy databases or schemas that have been optimized by specialized teams for enhanced performance.

On May 21, 2010, the original iBATIS development team forked the project to establish MyBatis, resulting in Apache iBATIS becoming inactive and subsequently archived in the Apache Attic as of June 2010.

Usage

Consider a scenario with a database table and a matching Java class ; an iBATIS XML mapping file specifies how to extract a product record:

<syntaxhighlight lang="xml+velocity">

   <select id="getProduct" parameterClass="java.lang.Long" resultClass="com.example.Product">
       select PROD_ID as id,
              PROD_DESC as description
         from PRODUCT
        where PROD_ID = #value#
   </select>

</syntaxhighlight>

To fetch a Product instance for product ID 123, one would use:

<syntaxhighlight lang="java">

   Product resultProduct = (Product) sqlMapClient.queryForObject("getProduct", 123);

</syntaxhighlight>

Within the mapping file, #value# is substituted with the query parameter. If the parameter is a Java object, its properties can be referenced similarly (for example, #id#). The sqlMapClient refers to an instance of com.ibatis.sqlmap.client.SqlMapClient.

Availability

Although its creator publicly criticized Java 5, iBATIS continued to see updates for Java, including releases 2.3.1 and 2.3.2 in April 2008, followed by 2.3.3 in July of the same year. The framework supports Java, .NET, and Ruby (under the name RBatis). Additionally, the jBati project provides a JavaScript ORM inspired by iBATIS principles.

The Apache iBator utility complements iBATIS by connecting to databases and generating both mapping files and Java classes utilizing metadata information.

History

Established in 2001 by Clinton Begin, iBATIS initially concentrated on cryptographic software development. Its inaugural product, Secrets, was an open-source Java application focused on personal data encryption and digital signing.

In 2001, Microsoft asserted that its .NET 1.0 offered higher productivity than Java, showcasing this claim with their implementation of Sun's Web "Pet Store" application. To challenge this assertion, Clinton created JPetStore in 2002 to demonstrate that Java could achieve comparable or superior productivity through improved architectural design.

JPetStore version 1.0 attracted considerable attention, especially for its database handling layer, which subsequently led to the formation of the iBATIS Database Layer 1.0 project—comprising iBATIS DAO and iBATIS SQL Maps.

The release of iBATIS 2.0 in June 2004 introduced a comprehensive redesign while preserving essential functionalities. Clinton contributed the project to the Apache Software Foundation, where it was maintained for six years. Over time, iBATIS DAO was phased out in favor of more advanced DAO frameworks such as Spring Framework.

On May 19, 2010, with development transitioning to Google Code under the new name MyBatis, iBATIS 3.0 was launched. Subsequently, Apache retired iBATIS on June 16, 2010, relocating it to the Apache Attic archive.

See also

Bibliography

  • Clinton Begin, Brandon Goodin, Larry Meadors, iBATIS in Action, Manning Publications, 1st edition, January 17, 2007, 384 pages, ISBN 978-1-932394-82-5
  • Chris Richardson, POJOs In Action, Manning Publications, 1st edition, January 23, 2006, 456 pages, ISBN 1-932394-58-3

External links