You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Ron Chan <rc...@i-tao.com> on 2006/12/16 01:10:53 UTC

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

thanks
Ron
-- 
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.


Re: ibatis v hibernate

Posted by Larry Meadors <lm...@apache.org>.
I'll share my story on this, too, but will say up-front that I am
(obviously) an iBATIS advocate.

I was an early adapter of ORM. I started with Hibernate 1.x before I
had ever heard of iBATIS. After a week or so a friend (who had also
used ORM - in the form of JDO) warned me that I would not like it, and
mentioned iBATIS. I didn't listen and decided to try it anyway.

What I found was that much of what I had learned over the previous 10
years about database design and SQL query optimization was thrown out
the window, and I had to learn a new query language..that would
generate my SQL for me. The problem was that it was just as complex as
SQL was, just nowhere near as much had been written about it.

Next, I learned that I could not get a value out of the database, I
could only get an object. No customer name, just a customer object.
Not real high performance, but it was still easy. Then I discovered
that if I wanted to join tables, I could still only get objects out -
so in the case of a join, I would get a List of Object arrays. At that
point, I started to think that maybe this wasn't such a great idea,
because I had to hard code the HQL into the application, and also
hard-code the array index to get to the correct object once I got the
array from the list - so for example, myJoin[0] is customer, and
myJoin[1] is order. I was beginning a new project, so I spent about 2
weeks writing a prototype application using ORM to test it out.

I was not very happy with the design that I was forced into, so I
decided maybe my friend was right, and downloaded iBATIS to see if it
would make things easier. After about 2 days, I had replaced the
entire data-access layer, and my "stale object" exceptions all went
away, performance was improved, and all of the other developers
already knew how to use it because it was just SQL.

So IMO, I do not agree that ORM (not just Hibernate) is better if you
have complete control of the data model. I DO believe it is better if
you are building a single-application database (no sharing with
others, no external reporting) *and* you have developers with little
or no knowledge of SQL or database design.

I'll even disagree with Clinton that "Designing for future need can be
a bad practice too", or maybe just emphasize the "can" - IMO, our
value as developers/consultants is based on our ability to look ahead
and see troubles before they arise (so, I am glad to see questions
like this on the list). I liked the Vietnam analogy, because in my
experience, ORM was a total quagmire. It was also VERY messy to
refactor out of an application once it had permeated it.

Larry


On 12/16/06, Clinton Begin <cl...@gmail.com> wrote:
> I'll let the user community speak to the practical experiences, but at a
> practices level consider the following at a philisophical level.
>
> All databases are legacy databases.  Any database that is of any value will
> ultimately become a dependency for more than the original application it was
> built for.  Inevitably other systems will start to report off of it, then
> perhaps write to it and ultimately will influence changes to the design.
> Unless they're all Java based applications using the same domain model and
> ORM, it's likely you'll run into the problem of a legacy design eventually,
> and the ORM will break down.
>
> In his blog[1], Ted Neward describes ORM as (forgiving the lack of political
> correctness) "The Vietnam of Computer Science"[2].  His point is basically
> that projects that start with ORM don't know what they're getting into, and
> eventually realize that it's a losing battle. It's a good point made in a
> very odd way.  ;-)
>
> To be fair, I'll counter my own point:  Designing for future need can be a
> bad practice too.  It's counter to Agile methods and therefore you might be
> better starting with Hibernate and then moving to iBATIS if or when you need
> to.
>
> Cheers,
> Clinton
>
> [1]
> http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx
> [2] Ted is an American who has family that fought in the Vietnam war, so I
> won't judge the analogy.
>
>
> On 12/15/06, Ron Chan <rc...@i-tao.com> wrote:
> >
> > 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
> >
> > thanks
> > Ron
> > --
> > 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.
> >
> >
>
>

RE: ibatis v hibernate

Posted by Shardayyy <sh...@gmail.com>.
This might be a good read.

 

http://www.mail-archive.com/ibatis-user-java@incubator.apache.org/msg01251.h
tml

 

 

 

  _____  

From: Clinton Begin [mailto:clinton.begin@gmail.com] 
Sent: Monday, December 18, 2006 11:37 PM
To: user-java@ibatis.apache.org
Subject: Re: ibatis v hibernate

 

The problem with pros and cons is that they change almost on a per project
basis.

I'd suggest just adding the above comments to the "Feedback and experiences"
section of the wiki page.

Cheers,
Clinton 



On 12/18/06, Eric T. Blue <er...@gmail.com> wrote:

IMHO, I think Larry and Nathan are both partially right.  I believe it's
safe to say that discussions on the topic of persistence frameworks in Java
are sometimes as intense as political or religious debates ;)  Personally, I
think a high-level breakdown of the differences between frameworks would be
good.  Even having a feature matrix that compares against some other
frameworks would be helpful for people that are in the process of evaluating
different solutions.  

Per Nathan's suggestion, I think it would be good to list some pros and cons
of different approaches.  And, I would be careful how one product is
categorized as better than the other.   Obviously, what's best is often
subjective, so there should ideally be some specific benchmarks ( e.g.
solution A's response time is faster than solution B w/ X concurrent users).

 

On 12/18/06, Nathan Maves < <ma...@gmail.com>
nathan.maves@gmail.com> wrote:

How about a more general description of the differences and usage. 

BTW there is nothing wrong with stating reasons why our product is better
then others at specific tasks.

Nathan

 

On 12/18/06, Larry Meadors <lm...@apache.org> wrote:

Heh, that it would probably be considered "flame-bait'.

Larry


On 12/18/06, Nathan Maves < nathan.maves@gmail.com
<ma...@gmail.com> > wrote:
> These are all great success stories.  Coming from someone who has never 
> tried Hibernate I love reading these.  What are some thought about putting
> together a page about IBATIS vs ORM (Hibernate)?
>
> Nathan
>

 





 


Re: ibatis v hibernate

Posted by Larry Meadors <lm...@apache.org>.
OK, per your request: I just talked to a developer who works for a
company that I worked with last summer (both of them will remain
nameless).

While I was there, we had a mapped statement that was a monster -
about 300-400 lines long when you combined the result map and the sql
statement. To run it on my notebook (at the time a 1.4GHz Centrino w/
768M or RAM) it took 1-2 seconds.

After my contract ended, the lead developer left, and the next guy in
line decided that iBATIS was too hard, and that MDA+Hibernate would be
way easier, and just as fast.

Here is part of the conversation I had earlier today (names changed to
protect the guilty):

 my-friend-without-a-name@hotmail.com: if you thought the (monster)
was pretty bad...
 my-friend-without-a-name@hotmail.com: the new (monster) does 16000
queries for one of our
   objects.
 larry_meadors@hotmail.com: :-|
 my-friend-without-a-name@hotmail.com: sixteen THOUSAND
 larry_meadors@hotmail.com: for the record...we did it with 1 (one)
single sql statement
 larry_meadors@hotmail.com: ONE
 larry_meadors@hotmail.com: :D
 my-friend-without-a-name@hotmail.com: ours takes 2 minutes to
complete on a dual xeon
 larry_meadors@hotmail.com: wow, that is impressive
 my-friend-without-a-name@hotmail.com: it's all about the big numbers
 my-friend-without-a-name@hotmail.com: 26k lines of xml
 my-friend-without-a-name@hotmail.com: 16000 queries
 my-friend-without-a-name@hotmail.com: 1 web page!
 larry_meadors@hotmail.com: everything else is priceless
 my-friend-without-a-name@hotmail.com: yes, the cost is infinite
 larry_meadors@hotmail.com: let's not quibble about semantics, here
 my-friend-without-a-name@hotmail.com: i figure we can handle about
three customers

Larry


On 12/19/06, Ron Chan <rc...@i-tao.com> wrote:
>
> Thank you all for some great feedback.  Especially the 2 for 1 deal from
> Clinton - an ORM discussion and a history lesson :)
>
> However, I'm still in search of "answers" - maybe it's because I'm not sure
> what it is I'm asking for, kind of like the answer to the ultimate question
> ;)
>
> I have tried Hibernate, many prototypes and tests, and one live app which we
> have supported and extended for over 2 years.  It has been an uphill
> struggle.  Although a lot the struggle was more down to moving from a
> "procedural with lots of SQL" mindset to a more OO paradigm, and much of
> what I have learnt thru doing it with hibernate would probably be applicable
> to getting more out of something like ibatis.
>
> I came across ibatis ~3 months ago, no learning curve at all and we have
> successfully delivered one small app already.
>
> What I'm looking for I guess, is positive affirmation that ditching all the
> hibernate hard work (not to mention many expensive books) and going down the
> ibatis path is the right route.
>
> It feels right, but still, I like to hear from other people with good
> experiences - would be really good if you can give brief description of what
> the problem was you were trying to solve or what the app was delivering.
> Rather than a like for like matrix type comparison, real "war stories with
> battle scars" would make it much more meaningful.
>
> Thanks
> Ron
>

Re: ibatis v hibernate

Posted by Ron Chan <rc...@i-tao.com>.
Thank you all for some great feedback.  Especially the 2 for 1 deal from
Clinton - an ORM discussion and a history lesson :)

However, I'm still in search of "answers" - maybe it's because I'm not sure
what it is I'm asking for, kind of like the answer to the ultimate question
;)

I have tried Hibernate, many prototypes and tests, and one live app which we
have supported and extended for over 2 years.  It has been an uphill
struggle.  Although a lot the struggle was more down to moving from a
"procedural with lots of SQL" mindset to a more OO paradigm, and much of
what I have learnt thru doing it with hibernate would probably be applicable
to getting more out of something like ibatis.

I came across ibatis ~3 months ago, no learning curve at all and we have
successfully delivered one small app already.

What I'm looking for I guess, is positive affirmation that ditching all the
hibernate hard work (not to mention many expensive books) and going down the
ibatis path is the right route.  

It feels right, but still, I like to hear from other people with good
experiences - would be really good if you can give brief description of what
the problem was you were trying to solve or what the app was delivering. 
Rather than a like for like matrix type comparison, real "war stories with
battle scars" would make it much more meaningful.

Thanks
Ron



Clinton Begin wrote:
> 
> The problem with pros and cons is that they change almost on a per project
> basis.
> 
> I'd suggest just adding the above comments to the "Feedback and
> experiences"
> section of the wiki page.
> 
> Cheers,
> Clinton
> 
> 
> On 12/18/06, Eric T. Blue <er...@gmail.com> wrote:
>>
>> IMHO, I think Larry and Nathan are both partially right.  I believe it's
>> safe to say that discussions on the topic of persistence frameworks in
>> Java
>> are sometimes as intense as political or religious debates ;) 
>> Personally, I
>> think a high-level breakdown of the differences between frameworks would
>> be
>> good.  Even having a feature matrix that compares against some other
>> frameworks would be helpful for people that are in the process of
>> evaluating
>> different solutions.
>>
>> Per Nathan's suggestion, I think it would be good to list some pros and
>> cons of different approaches.  And, I would be careful how one product is
>> categorized as better than the other.   Obviously, what's best is often
>> subjective, so there should ideally be some specific benchmarks ( e.g.
>> solution A's response time is faster than solution B w/ X concurrent
>> users).
>>
>> On 12/18/06, Nathan Maves < nathan.maves@gmail.com> wrote:
>> >
>> > How about a more general description of the differences and usage.
>> >
>> > BTW there is nothing wrong with stating reasons why our product is
>> > better then others at specific tasks.
>> >
>> > Nathan
>> >
>> > On 12/18/06, Larry Meadors <lm...@apache.org> wrote:
>> > >
>> > > Heh, that it would probably be considered "flame-bait'.
>> > >
>> > > Larry
>> > >
>> > >
>> > > On 12/18/06, Nathan Maves < nathan.maves@gmail.com> wrote:
>> > > > These are all great success stories.  Coming from someone who has
>> > > never
>> > > > tried Hibernate I love reading these.  What are some thought about
>> > > putting
>> > > > together a page about IBATIS vs ORM (Hibernate)?
>> > > >
>> > > > Nathan
>> > > >
>> > >
>> >
>> >
>>
> 
> 

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


Re: ibatis v hibernate

Posted by Clinton Begin <cl...@gmail.com>.
The problem with pros and cons is that they change almost on a per project
basis.

I'd suggest just adding the above comments to the "Feedback and experiences"
section of the wiki page.

Cheers,
Clinton


On 12/18/06, Eric T. Blue <er...@gmail.com> wrote:
>
> IMHO, I think Larry and Nathan are both partially right.  I believe it's
> safe to say that discussions on the topic of persistence frameworks in Java
> are sometimes as intense as political or religious debates ;)  Personally, I
> think a high-level breakdown of the differences between frameworks would be
> good.  Even having a feature matrix that compares against some other
> frameworks would be helpful for people that are in the process of evaluating
> different solutions.
>
> Per Nathan's suggestion, I think it would be good to list some pros and
> cons of different approaches.  And, I would be careful how one product is
> categorized as better than the other.   Obviously, what's best is often
> subjective, so there should ideally be some specific benchmarks ( e.g.
> solution A's response time is faster than solution B w/ X concurrent users).
>
> On 12/18/06, Nathan Maves < nathan.maves@gmail.com> wrote:
> >
> > How about a more general description of the differences and usage.
> >
> > BTW there is nothing wrong with stating reasons why our product is
> > better then others at specific tasks.
> >
> > Nathan
> >
> > On 12/18/06, Larry Meadors <lm...@apache.org> wrote:
> > >
> > > Heh, that it would probably be considered "flame-bait'.
> > >
> > > Larry
> > >
> > >
> > > On 12/18/06, Nathan Maves < nathan.maves@gmail.com> wrote:
> > > > These are all great success stories.  Coming from someone who has
> > > never
> > > > tried Hibernate I love reading these.  What are some thought about
> > > putting
> > > > together a page about IBATIS vs ORM (Hibernate)?
> > > >
> > > > Nathan
> > > >
> > >
> >
> >
>

Re: ibatis v hibernate

Posted by "Eric T. Blue" <er...@gmail.com>.
IMHO, I think Larry and Nathan are both partially right.  I believe it's
safe to say that discussions on the topic of persistence frameworks in Java
are sometimes as intense as political or religious debates ;)  Personally, I
think a high-level breakdown of the differences between frameworks would be
good.  Even having a feature matrix that compares against some other
frameworks would be helpful for people that are in the process of evaluating
different solutions.

Per Nathan's suggestion, I think it would be good to list some pros and cons
of different approaches.  And, I would be careful how one product is
categorized as better than the other.   Obviously, what's best is often
subjective, so there should ideally be some specific benchmarks (e.g.
solution A's response time is faster than solution B w/ X concurrent users).

On 12/18/06, Nathan Maves <na...@gmail.com> wrote:
>
> How about a more general description of the differences and usage.
>
> BTW there is nothing wrong with stating reasons why our product is better
> then others at specific tasks.
>
> Nathan
>
> On 12/18/06, Larry Meadors <lm...@apache.org> wrote:
> >
> > Heh, that it would probably be considered "flame-bait'.
> >
> > Larry
> >
> >
> > On 12/18/06, Nathan Maves <na...@gmail.com> wrote:
> > > These are all great success stories.  Coming from someone who has
> > never
> > > tried Hibernate I love reading these.  What are some thought about
> > putting
> > > together a page about IBATIS vs ORM (Hibernate)?
> > >
> > > Nathan
> > >
> >
>
>

Re: ibatis v hibernate

Posted by Nathan Maves <na...@gmail.com>.
How about a more general description of the differences and usage.

BTW there is nothing wrong with stating reasons why our product is better
then others at specific tasks.

Nathan

On 12/18/06, Larry Meadors <lm...@apache.org> wrote:
>
> Heh, that it would probably be considered "flame-bait'.
>
> Larry
>
>
> On 12/18/06, Nathan Maves <na...@gmail.com> wrote:
> > These are all great success stories.  Coming from someone who has never
> > tried Hibernate I love reading these.  What are some thought about
> putting
> > together a page about IBATIS vs ORM (Hibernate)?
> >
> > Nathan
> >
>

Re: ibatis v hibernate

Posted by Larry Meadors <lm...@apache.org>.
Heh, that it would probably be considered "flame-bait'.

Larry


On 12/18/06, Nathan Maves <na...@gmail.com> wrote:
> These are all great success stories.  Coming from someone who has never
> tried Hibernate I love reading these.  What are some thought about putting
> together a page about IBATIS vs ORM (Hibernate)?
>
> Nathan
>

Re: ibatis v hibernate

Posted by Nathan Maves <na...@gmail.com>.
These are all great success stories.  Coming from someone who has never
tried Hibernate I love reading these.  What are some thought about putting
together a page about IBATIS vs ORM (Hibernate)?

Nathan

On 12/17/06, Hariharan, Vadivelu (IE10) <Ha...@honeywell.com>
wrote:
>
>  Here are my cents on Ibatis Vs Hibernate
>
>
>
> Background
>
> ---------------------
>
> I started with hibernate and have used it extensively right from 1.Xrelease, at that time I had no clue about other popular ORM
>
> Solutions, until I came across this article on javalobby.
>
>
>
> In my organization many projects are using hibernate and they are still in
> development stage, we rolled out the first application
>
> Using Ibatis to production, I just have a single project experience on
> Ibatis, but here are my thoughts.
>
>
>
>    1. Learning Curve
>
> To write good code in any technology, you need to be a champion in it, I
> have met many developers who know hibernate but not masters in it
>
> Learning curve with iBatis is the most simplest you can ever think of, you
> can jump start as a plain JDBC developer and start with mapping you DAO's
> with JDBC query
>
>
>
>    1. SQL tuning
>
> I believe that SQL tuning is DBA's job, in any enterprise application you
> will go through this phase, and Ibatis is quite handy in here
>
> As your DBA need not know about the technology you are using and simply
> provides you the best optimized query, developers need to map
>
> The SQL's appropriately.
>
>
>
>    1. Performance
>
> Object creation is definitely increases memory footprint of the app and
> increases GC cycles too, I guess hibernate Object graphs are much more
> complex
>
> And traversal of the result needs more object creation as compared to
> Ibatis
>
>
>
>    1. Environment
>
> We did not have any major issues to deploy the app on WebSphere
> environment, while some of the other teams using hibernate have complained
> about tons of issues
>
>
>
>    1. Active group
>
>
>
> Ibatis is been a fantastic forum, during our development stage we reported
> a bug in Abator (http://issues.apache.org/jira/browse/IBATIS-348) and it
> was fixed in no time, I guess community support is very important as well.
>
>
>
>             Overall we have had a great application performance in the
> production system, and the development team was more than happy to adopt to
> this shift in technology.
>
>
>
> Thx.
>
> -Hari
>
>
>
>
>  ------------------------------
>
> *From:* Clinton Begin [mailto:clinton.begin@gmail.com]
> *Sent:* Saturday, December 16, 2006 3:24 PM
> *To:* user-java@ibatis.apache.org
> *Subject:* Re: ibatis v hibernate
>
>
>
> I'll let the user community speak to the practical experiences, but at a
> practices level consider the following at a philisophical level.
>
> All databases are legacy databases.  Any database that is of any value
> will ultimately become a dependency for more than the original application
> it was built for.  Inevitably other systems will start to report off of it,
> then perhaps write to it and ultimately will influence changes to the
> design.  Unless they're all Java based applications using the same domain
> model and ORM, it's likely you'll run into the problem of a legacy design
> eventually, and the ORM will break down.
>
> In his blog[1], Ted Neward describes ORM as (forgiving the lack of
> political correctness) "The Vietnam of Computer Science"[2].  His point is
> basically that projects that start with ORM don't know what they're getting
> into, and eventually realize that it's a losing battle. It's a good point
> made in a very odd way.  ;-)
>
> To be fair, I'll counter my own point:  Designing for future need can be a
> bad practice too.  It's counter to Agile methods and therefore you might be
> better starting with Hibernate and then moving to iBATIS if or when you need
> to.
>
> Cheers,
> Clinton
>
> [1]
> http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx
> [2] Ted is an American who has family that fought in the Vietnam war, so I
> won't judge the analogy.
>
> On 12/15/06, *Ron Chan* <rc...@i-tao.com> wrote:
>
>
> 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
>
> thanks
> Ron
> --
> 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.
>
>
>

RE: ibatis v hibernate

Posted by Abdullah Kauchali <ab...@isanusi.com>.
>From: Clinton Begin [mailto:clinton.begin@gmail.com] 
>http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx

Thank you very much, I enjoyed that thoroughly.  :)


RE: ibatis v hibernate

Posted by "Hariharan, Vadivelu (IE10)" <Ha...@honeywell.com>.
Here are my cents on Ibatis Vs Hibernate

 

Background

---------------------

I started with hibernate and have used it extensively right from 1.X
release, at that time I had no clue about other popular ORM

Solutions, until I came across this article on javalobby.

 

In my organization many projects are using hibernate and they are still
in development stage, we rolled out the first application

Using Ibatis to production, I just have a single project experience on
Ibatis, but here are my thoughts.

 

1.	Learning Curve

To write good code in any technology, you need to be a champion in it, I
have met many developers who know hibernate but not masters in it

Learning curve with iBatis is the most simplest you can ever think of,
you can jump start as a plain JDBC developer and start with mapping you
DAO's with JDBC query

 

2.	SQL tuning

I believe that SQL tuning is DBA's job, in any enterprise application
you will go through this phase, and Ibatis is quite handy in here

As your DBA need not know about the technology you are using and simply
provides you the best optimized query, developers need to map 

The SQL's appropriately.

 

3.	Performance

Object creation is definitely increases memory footprint of the app and
increases GC cycles too, I guess hibernate Object graphs are much more
complex

And traversal of the result needs more object creation as compared to
Ibatis

 

4.	Environment

We did not have any major issues to deploy the app on WebSphere
environment, while some of the other teams using hibernate have
complained about tons of issues

 

5.	Active group

 

Ibatis is been a fantastic forum, during our development stage we
reported a bug in Abator
(http://issues.apache.org/jira/browse/IBATIS-348) and it was fixed in no
time, I guess community support is very important as well.

 

            Overall we have had a great application performance in the
production system, and the development team was more than happy to adopt
to this shift in technology.

 

Thx.

-Hari

 

 

________________________________

From: Clinton Begin [mailto:clinton.begin@gmail.com] 
Sent: Saturday, December 16, 2006 3:24 PM
To: user-java@ibatis.apache.org
Subject: Re: ibatis v hibernate

 

I'll let the user community speak to the practical experiences, but at a
practices level consider the following at a philisophical level.

All databases are legacy databases.  Any database that is of any value
will ultimately become a dependency for more than the original
application it was built for.  Inevitably other systems will start to
report off of it, then perhaps write to it and ultimately will influence
changes to the design.  Unless they're all Java based applications using
the same domain model and ORM, it's likely you'll run into the problem
of a legacy design eventually, and the ORM will break down. 

In his blog[1], Ted Neward describes ORM as (forgiving the lack of
political correctness) "The Vietnam of Computer Science"[2].  His point
is basically that projects that start with ORM don't know what they're
getting into, and eventually realize that it's a losing battle. It's a
good point made in a very odd way.  ;-) 

To be fair, I'll counter my own point:  Designing for future need can be
a bad practice too.  It's counter to Agile methods and therefore you
might be better starting with Hibernate and then moving to iBATIS if or
when you need to. 

Cheers,
Clinton

[1]
http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.as
px
[2] Ted is an American who has family that fought in the Vietnam war, so
I won't judge the analogy. 

On 12/15/06, Ron Chan <rc...@i-tao.com> wrote:


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

thanks
Ron
--
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.

 


Re: ibatis v hibernate

Posted by Clinton Begin <cl...@gmail.com>.
I'll let the user community speak to the practical experiences, but at a
practices level consider the following at a philisophical level.

All databases are legacy databases.  Any database that is of any value will
ultimately become a dependency for more than the original application it was
built for.  Inevitably other systems will start to report off of it, then
perhaps write to it and ultimately will influence changes to the design.
Unless they're all Java based applications using the same domain model and
ORM, it's likely you'll run into the problem of a legacy design eventually,
and the ORM will break down.

In his blog[1], Ted Neward describes ORM as (forgiving the lack of political
correctness) "The Vietnam of Computer Science"[2].  His point is basically
that projects that start with ORM don't know what they're getting into, and
eventually realize that it's a losing battle. It's a good point made in a
very odd way.  ;-)

To be fair, I'll counter my own point:  Designing for future need can be a
bad practice too.  It's counter to Agile methods and therefore you might be
better starting with Hibernate and then moving to iBATIS if or when you need
to.

Cheers,
Clinton

[1]
http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx
[2] Ted is an American who has family that fought in the Vietnam war, so I
won't judge the analogy.

On 12/15/06, Ron Chan <rc...@i-tao.com> wrote:
>
>
> 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
>
> thanks
> Ron
> --
> 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.
>
>

RE: ibatis v hibernate

Posted by Chris Lamey <cl...@localmatters.com>.
Hello,

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.

Cheers,
topher

-----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

thanks
Ron
-- 
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.