ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Lamey" <cla...@localmatters.com>
Subject RE: ibatis v hibernate
Date Sat, 16 Dec 2006 19:30:53 GMT

My group currently uses iBATIS with several 'from scratch' data models.  We used Hibernate
as an experiment on one data model before settling on iBATIS for everything.  What I would
say about the two is that if you don't know SQL and you don't want to know about SQL and you
have large data sets and high performance isn't a concern, use Hibernate 3 with annotations.
 Out of the box Hibernate is very easy for Java programmers to use, as it shields you from
knowing anything about your database other than as a object->table data store.  However,
if you know SQL and want a high degree of control over what SQL gets used against your database,
or you have large data sets, or high performance is a concern, use iBATIS.  I am very comfortable
with SQL and could not stand not knowing exactly what Hibernate would do at runtime.  I didn't
like the fact that I spent more of my time reverse-engineering Hibernate's behavior and tweaking
it's configuration than writing the exact SQL that I wanted to run at that exact point in
the code.  It went something like "Hey, I need this SQL statement right here...I wonder how
I tweak the annotation to get that to happen?" over and over again.  It's entirely possible
to write raw SQL in Hibernate, but then what's the point?  Plus you have to consider all the
caches and data synchronization issues.  Hibernate is really an object view of the world with
a database behind it...I guess I see the database model and performance as a higher priority
than working with a "correct" OO API.

Really, I tend to think of Hibernate as an ORM and iBATIS as a full-featured JDBC wrapper.

I've also used iBATIS with old crufty data models and it is absolutely better than hibernate
because you can wedge in all kind of crazy into the SQL with ease.

Another group in the company started and stuck with Hibernate with a "from scratch" data model
for their project because it had no impact on the start of their project.  They just wrote
up a schema and they were off an running.  It was great up until they started running into
production scalabilty issues because they had no idea what was going on, up until then it
had "just worked".  So they had to do some emergency work to change their code to get Hibernate
to scale and peform.  They have since decided to switch to iBATIS and take a little more of
a hit up front.

Being able to hand of the SQL map to a DBA and say "Here's the SQL we use" is huge.

Anyway, that's my experience.  Everybody is different.  Download them both, wire them up against
the database and see what you like.

Oh, and if you go with iBATIS, I would highly recommend Spring's SqlMapTemplate and DAOs.
 Also take a look at Abator, which can provide a bunch of boilerplate CRUD work if you want
or at a minimum can show you some good iBATIS techniques.


-----Original Message-----
From: Ron Chan [mailto:rchan@i-tao.com]
Sent: Fri 12/15/2006 5:10 PM
To: user-java@ibatis.apache.org
Subject: ibatis v hibernate

there's a lot of "advice" around that says hibernate is better when you have
complete control of the data model, and ibatis is better when you are
working on an existing database

i would like to hear from people who has had good experiences with ibatis
even though they are creating the data model from scratch, and how they feel
it's been better for them than using hibernate

View this message in context: http://www.nabble.com/ibatis-v-hibernate-tf2830264.html#a7901667
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

View raw message