Currently my company uses “IBATIS” and pure “SQL” as the database persistence mechanism. I really like SQL query especially in wrap, but I just don’t like the code of all SQL queries in Java application, it’s an easy typo and what a stupid and tedious job. I decided to propose an O/R mapping mechanism (Hibernate) as our new Java database persistence mechanism.

Why do we need O/R mapping?

1) Productivity – Helps developer get rid of writing complex and tedious SQL statements, developer no longer needs JDBC APIs for result set or data handling. It makes the developer focus more on business logic.

2) Maintainability – Helps to reduce the lines of code, makes the system more understandable. It emphasizes business logic instead of persistence (SQL) work. More importantly, a system with less code is easier to refactor.

3) Portability – Abstracts our application from the underlying SQL database and sql dialect. Switching to another SQL database requires few changes to the Hibernate configuration file (write once/run anywhere)

Here are some popular open source persistence frameworks in Java

1) Hibernate

2) EJB3

3) Oracle top link

4) Cayenne

5) OpenJPA

6) IBATIS

7) JPOX

I don’t want to compare each O/R or non-O/R persistence mechanism individually, it may spend more than a month included in research and hands-on practice. Based on my personal humble opinion, I will choose Hibernate as the best O/R mapping persistence mechanism over the other tools.

Reason to choose Hibernate

1) Provides all of the above O/R benefits. (Productivity, Maintainability, Portability).

2) It is free and open source – Cost-effective

3) The learning curve is short. It is a totally object oriented concept, it will shorten our learning curve.

4) The “Hibernate tools” provided by the community help the developer to build or develop applications very quickly and easily. (Eclipse Code and Plugin Generation Tools)

5) It is popular, when we make a mistake, we can easily find the answer on Google. Plus, there are plenty of books, communities, and forums to support you.

6) Java Market needs itHibernate developer demand is increasing and definitely more than the other tools. This work experience definitely adds perks on our resume for the next jump.