Why you should learn IBATIS, an ORM???
Data mapping seems to be a challenging task around for years. IBATIS is one of the very popular frameworks like hibernate, JPA (java persistance API) etc. to do so. In this post, you will learn about what IBATIS is? and why you should use it?
What you achieve if you are using IBATIS:
Your application will be able to persist and retrieve data. I know you do this using jdbc, then why using IBATIS: there are plenty of good reasons to use IBATIS in your application. some of these are-
1) It eliminates almost all of the JDBC code and manual setting of parameters and retrieval of results.
(which means we get escape from 80% of the JDBC code; so your code will be simple to read and having lesser number of lines).
2) You do not need to worry about opening or closing the database connection. It will be done automatically.
3) You do not need to manage the result set for the executed query.
4) In traditional JDBC calls: when we run any JDBC query, we get resultset and then we need to iterate thorugh the resultset to frame a collection object e.g a list, map etc
But in IBATIS, you just need to mention in which collection object you would like to store the DB results and then, when you run the query you
do not get resultset object but get the desirect collection object containing the DB resutls.
i.e just fire a query and get the results in the desired collection object.
5) Learning curve for IBATIS is very very short. you would need to use simple xml or annotations for configuring it. (which I have observed is very much simple
6) You do not need to learn a new SQL query language as is the case with other frameworks like hibernate where you need
to learn HQL.
7) IBATIS supports our very own SQL, stored procedures and advanced mappings.
8) IBATIS can map java POJOs (Plain old Java objects) to database records.
9) You can call stored procedure as any other SQL query.
10) It will hide almost all the complexities of jdbc.
the above reasons are good enough to go with IBAITS. Still I beleive, there are few more good
reasons( for Advance users) to go with IBATIS:
11. It has got Auto commit and Auto Rollback feature for executing a query.
12.takes care of number of threads that can execute a query.
13. To achieve connection pooling, you just need to set a property in the
configurational file and you are done.
14. It supports cache management for faster results and many more features.Has got support for both Read only and Read/Write Caching Mapped Statement Results.
Using JDBC is a good approach but if you have some framework which can serve you
getting more from JDBC with simple code(lesser number of lines) with many
advance features, what else you want?