Monday, October 25, 2010

Ibatis Vs Hibernate

I have using Hibernate and Ibatis for a year now, and I find myself switching twice from Hibernate to iBatis, not because one is better than the other, it's because of what preperations each framework needs.

In hibernate you need to have a proper plan to design your database, the database is controled by the hibernate roles and you spend time try to fullfill these rules, and if you go the other way (database->OO) it's harder.

With Ibatis I find myself getting the Job done faster, I create any POJO any set of tables, and I link them, much flixability in that field, but little extra work, building Queries and managing Maps (but hay, you spend time with hibernate maps too).

Both are good in a way with iBatis you finish the Job faster, which I like, but you won't have the big tools that hibernate provide, nor iBatis will provide the facility to generate the sql for you.

With Hibernate3 it maybe a different story, since allot of what can stop you in H2 and make you think of iBatis is there in H3, still iBatis is growing up.

ibatis:
-Simpler
-faster development time
-flixable
-Much smaller in package size

hibernate:
-generate SQL for you which means you don't spend time on SQL
-provide much more advance cache
-scalable

For now I use iBatis, but keeping my eyes on Hibernate3, by the way, you can always use iBatis to have a fast start, and move to hibernate on late stages if you want, iBatis provide special DAO framework for that.

Learn both, use both, and if you don't have time learn and use iBatis, you won't regret it.

1 comment:

Pankaj Saha said...

Hi Ujjwal
Thanks for sharing your experience and some good key points of both the framework.
I have been working with iBatis(apache), may be its now changed to myBatis 3.x

The problem with iBatis is its very very slow.Dont know why.So i planned migrate my project to Hibernate, and i find its very much rules driven and many places it forced me to change my Table tittle bit.So now i am in dilemma which frame work to use.either slow(very slow in my case)/simple iBatis or faster/managed Hibernate.

Can you please let me know if u also faced that issue with iBatis Framework and if then how did you resolved it.currently i am using iBatis 2.x

Thanks
Pankaj
As you have worked with it