IBATIS
Encyclopedia
iBATIS is a persistence framework
Persistence framework
A persistence framework is middleware that assists and automates the storage of program data into databases, especially relational databases.It acts as a layer of abstraction between the application and the database, typically bridging any conceptual differences between the two.Many persistence...

 which automates the mapping between SQL
SQL
SQL is a programming language designed for managing data in relational database management systems ....

 databases and objects in Java, .NET, and Ruby on Rails. In Java, the objects are POJOs (Plain Old Java Object
Plain Old Java Object
In computing software, POJO is an acronym for Plain Old Java Object. The name is used to emphasize that a given object is an ordinary Java Object, not a special object...

s). The mappings are decoupled from the application logic by packaging the SQL statements in XML
XML
Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....

 configuration files. The result is a significant reduction in the amount of code that a developer needs to access a relational database using lower level APIs like JDBC and ODBC.

Other persistence frameworks such as Hibernate
Hibernate (Java)
Hibernate is an object-relational mapping library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database...

 allow the creation of an object model (in Java, say) by the user, and create and maintain the relational database automatically. iBATIS takes the reverse approach: the developer starts with an SQL database and iBATIS automates the creation of the Java objects. Both approaches have advantages, and iBATIS is a good choice when the developer does not have full control over the SQL database schema. For example, an application may need to access an existing SQL database used by other software, or access a new database whose schema is not fully under the application developer's control, such as when a specialized database design team has created the schema and carefully optimized it for high performance.

On May 21, 2010 the development team decided to move from ASF to Google code
Google Code
Google Code is Google's site for developer tools, APIs and technical resources. The site contains documentation on using Google developer tools and APIs—including discussion groups and blogs for developers using Google's developer products....

 changing the project name to MyBatis
MyBatis
MyBatis is a persistence framework available for Java and .NET that couples objects with stored procedures or SQL statements using an XML descriptor or annotations.MyBatis is free software that is distributed under the Apache License 2.0....

.

Usage

For example, assume there is a database table PRODUCT (PROD_ID INTEGER, PROD_DESC VARCHAR(64)) and a Java class com.example.Product (id: int, description: String). To read the product record having the key PROD_ID into a new Product POJO, the following mapping is added into an iBATIS XML mapping file:





A new Java Product object can then be retrieved from the database for product number 123 as follows:


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


In the mapping file example, #value# refers to the long integer value passed into the query. If the parameter is a Java object, then values from properties on that object can be inserted into the query using a similar # notation. For example, if the parameter class is a com.example.Product which has a property called id, then #value# can be replaced with #id#. The sqlMapClient object is an instance of class com.ibatis.sqlmap.client.SqlMapClient.

Availability

The founder of iBATIS has publicly stated his dismay with Java 5, but has continued to release new versions of iBATIS for Java. Versions 2.3.1 and 2.3.2 came out in April 2008, and 2.3.3 in July. Work is also underway on release 3.0.0, whose features are being discussed here.

The framework is currently available in Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

, .NET
.NET Framework
The .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...

, and Ruby
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...

 (RBatis) versions. The jBati project is a JavaScript ORM
Orm
Orm became an Anglo-Saxon personal name during period of the Danelaw...

 inspired by iBATIS.

The Apache iBator tool is closely related: it connects to your database and uses SQL introspection to generate iBATIS mapping files and Java classes.

Project Status

Project development is currently inactive as of June 16th 2010, iBATIS has been retired as mentioned on the official site.

On May 19, 2010 iBATIS
IBATIS
iBATIS is a persistence framework which automates the mapping between SQL databases and objects in Java, .NET, and Ruby on Rails. In Java, the objects are POJOs . The mappings are decoupled from the application logic by packaging the SQL statements in XML configuration files...

 3.0 is published and simultaneously the development team decided to continue the development of the framework at Google Code
Google Code
Google Code is Google's site for developer tools, APIs and technical resources. The site contains documentation on using Google developer tools and APIs—including discussion groups and blogs for developers using Google's developer products....

  under the new name MyBatis
MyBatis
MyBatis is a persistence framework available for Java and .NET that couples objects with stored procedures or SQL statements using an XML descriptor or annotations.MyBatis is free software that is distributed under the Apache License 2.0....

.

See also

  • MyBatis
    MyBatis
    MyBatis is a persistence framework available for Java and .NET that couples objects with stored procedures or SQL statements using an XML descriptor or annotations.MyBatis is free software that is distributed under the Apache License 2.0....

  • Java Persistence API
    Java Persistence API
    The Java Persistence API, sometimes referred to as JPA, is a Java programming language framework managing relational data in applications using Java Platform, Standard Edition and Java Platform, Enterprise Edition....

  • Hibernate
    Hibernate (Java)
    Hibernate is an object-relational mapping library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database...

  • EclipseLink
    EclipseLink
    EclipseLink is the open source Eclipse Persistence Services Project from the Eclipse Foundation. The software provides an extensible framework that allows Java developers to interact with various data services, including databases, web services, Object XML mapping , and Enterprise Information Systems...

  • Apache Cayenne
    Apache Cayenne
    Apache Cayenne is an open source persistence framework licensed under the Apache License, providing object-relational mapping and remoting services. Cayenne binds one or more database schemas directly to Java objects, managing atomic commit and rollbacks, SQL generation, joins, sequences, and more...

  • Spring Framework
    Spring Framework (Java)
    The Spring Framework is an open source application framework for the Java platform.The first version was written by Rod Johnson, who released the framework with the publication of his book Expert One-on-One J2EE Design and Development in October 2002. The framework was first released under the...

  • pureQuery
  • NHydrate
    Nhydrate
    nHydrate is an object-relational mapping solution for the Microsoft .NET platform providing a framework for a relational database to be mapped to .NET objects...

  • OpenJPA
  • O/R Broker, similar framework for Scala
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK