File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes iBatis vs hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "iBatis vs hibernate" Watch "iBatis vs hibernate" New topic

iBatis vs hibernate

Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
Can someone point out which one is better ? why some people pick one over the other ?
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
iBATIS is very simple.
Hibernate is much more complex.

If you are a SQL expert and want to write SQL yourself, choose iBATIS.

But if you don't want to write SQL and you prefer more object-oriented query language and have much time to learn OR-mapping concepts and features, choose Hibernate.

iBATIS is so simple, it is just about XML, SQL, and plain-old objects, nothing more than that.

iBATIS is just a data mapper framework it maps fields in RDBMS tables to attributes in objects while Hibernate is an OR-mapping tool it maps objects to relational database.

Sounds similar, but OR-mapping is higher level than data mapping.
[ December 08, 2008: Message edited by: Kengkaj Sathianpantarit ]

SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
John Griffin

Joined: Oct 24, 2008
Posts: 22

Years ago I had to make a decision between the various ORM systems as to which one to implement. At that time rumor had it that EJB3 would use Hibernate as it's basic methodology (I know the politics behind the decision but that doesn't matter now). We were an EJB company so the decision was easy, Hibernate.

I would bet that more than just us made that decision for the same reason.

John G
Mads jacobsen

Joined: Nov 20, 2008
Posts: 7
The main difference between Hibernate and iBatis is that hibernate maps your objects to tables whereas iBatis maps your objects to SQL queries.

You can also consider the fact that even though HQL is great you can do much more with pure SQL, and it might even perform a great deal better with iBatis then Hibernate, as it allows you to take 100% control of the queries executed.
Emmanuel Bernard
Ranch Hand

Joined: Oct 22, 2008
Posts: 62
A few facts on iBatis vs Hibernate:
- you can actually override every single SQL statement Hibernate generates if you want to. So in essence, Hibernate does everything iBatis does. The description syntax is lighter on iBatis but you will probably not want to rewrite all Hibernate queries, so all in all the syntax overhead is probably easily overcome.
- Hibernate is much more than iBatis in the sense that it is a persistence context that guarantees a lot of things including object unicity, transparent object checking, first (and second) object level cache and many more things.

The philosophy is way different in the end. One focuses a lot of pure SQL and simple mapping, while Hibernate does focuses on mapping your domain model and managing object state changes for you whil providing you an object oriented query model (and let you back up to SQL if you need to). Also, no Hibernate has full-text search queries thanks to Hibernate Search
I agree. Here's the link:
subject: iBatis vs hibernate
It's not a secret anymore!