iBATIS
From Wikipedia, the free encyclopedia
Apache iBATIS | |
---|---|
Developed by | Apache Software Foundation |
Written in | Java |
OS | Cross-platform |
Genre | Persistence Framework |
License | Apache License 2.0 |
Website | http://ibatis.apache.org |
iBATIS is a persistence framework which enables mapping SQL queries to POJOs (Plain Old Java Objects). The SQL queries are decoupled from an application by putting the queries in XML files. Mapping of the retrieved objects is automatic or semi-automatic.
The basic idea behind the iBATIS introduction was to significantly reduce the amount of Java code that a Java developer normally needs to access a relational database with the use of XML files containing SQL queries.
For example there may exist a database table PRODUCT (PRD_ID: INTEGER, PRD_DESCRIPTION: VARCHAR) and a Java object com.example.Product (id: int, description: String). To populate the contents of a particular PRODUCT of a specified PRD_ID into the Product POJO we would insert the following into an XML SQL map:
<select id="getProduct" parameterClass="java.lang.Long" resultClass="com.example.Product"> select PRD_ID as id, PRD_DESCRIPTION as description from PRODUCT where PRD_ID = #id# </select>
The Java code which sets up a parameter object and populates the result object is as follows:
Long id = new Long(123); Product resultProduct = IBatis.getObject("getProduct", id);
Note the #id# comes from the parameter object.
The founder of iBatis has publically stated his dismay with Java 5, and perhaps it is no coincidence that the Java release 2.3.0 in December 2006 was the last until 2.3.1 and 2.3.2 came out in April 2008. Work is underway on release 3.0.0, whose features are being discussed here.
The framework is currently available in Java, .NET, and Ruby (RBatis) versions.
[edit] See also
[edit] External links
|