Hibernate vs. iBATIS
There's an interesting thread taking place on the iBATIS User Mailing List. The basic jist of the responses are: Hibernate works well when you control the data model, iBATIS works well when you need to integrate with an existing database. I've said this for a couple years now, and I still believe it. Furthermore, I've found that when working with iBATIS, I tend to know what's going on a lot more. After all, it's just SQL. From all the questions on the AppFuse mailing list, it seems like a lot of Hibernate users are constantly trying to get Hibernate to "work its magic" and handle all their relationships for them.
I wonder if newbies would be better of using iBATIS? Using iBATIS, there isn't a whole lot of magic, and you get full control over the SQL - which would likely be easier to understand. Maybe I should create a "newbie" version of AppFuse - where the frameworks uses are the easiest to learn or most documented. It'd probably be Struts+Spring+iBATIS, or maybe just Spring+iBATIS so I could sell more copies of Spring Live.
2. Regarding Spring Live: is there really and advantage for the autor to publish a book in "live mode", instead of the tradional one? (since only a few books use this strategy - compared to the high number of IT books)
Posted by Ahmed Mohombe on February 28, 2005 at 05:12 PM MST #
Ahmed, there is an absolute advantage to publishing a book in the "live mode", especially when dealing with the open source model. Let's look at Matt's book. In the next few months, Spring will release version 1.2. At that time, Matt will most likely make additions to "Spring Live" that will cover the new functionality and features. This would be near impossible with the traditional model.
With the "live mode", it seems to be the difference in writing solely history or history with current event updates.
Of course, I am *slightly* biased.
Cheers,Matthew Porter
Posted by Matthew Porter on February 28, 2005 at 06:24 PM MST #
Posted by Ahmed Mohombe on February 28, 2005 at 06:31 PM MST #
Posted by Wayland Chan on February 28, 2005 at 07:12 PM MST #
Posted by Vinny Carpenter on March 01, 2005 at 02:17 AM MST #
Posted by PJ Hyett on March 01, 2005 at 07:02 AM MST #
What you said sounds like from some politician :), or some manager that don't wan't to rise my wage :).
to Vinny:
"People are so happy that they can debug an application". This is simply not true. People are so happy when they don't need to debug an application - they use unit tests (and test cases) to prevent it from the begining. Besides, if the application is so well designed like AppFuse, than you can separate your concerns, so only in extreme situations one realy needs to debug the application as an entire, and to step in every library.
I personally like all the magic from AppFuse/Hibernate/AppGen/middlegen/hibernate_synchronizer/etc. . Concentrating on the the essential in an application is really fun. If I would want to controll everything than I would end up with Assambler.
Why do ask so many people here about Hibernate?
Because Hibernate is bad? No! Most of the users get scared on the Hibernate forums and when they don't get the RTFM, than some half answer that mostly doesn't help a newbie. Matt on the other hand, explains everything so good that even newbies understand this - IMHO this is the key difference.
Posted by Ahmed Mohombe on March 01, 2005 at 10:41 AM MST #
Posted by Jaime F. Zarama on March 01, 2005 at 03:22 PM MST #
Posted by anon on March 01, 2005 at 03:53 PM MST #
I personally like iBatis better due to my strength in SQL. Hibernate's abstraction of SQL doesn't allow me to truly understand what's happening. Plus the ability to write custom SQL in Hibernate buys very little for the complexity. I can appreciate those people who don't have a solid understanding of SQL and their use of Hibernate. I just find that level of abstraction unnecessary and more complex especially when something goes wrong.
Posted by Chris Rosenquest on March 01, 2005 at 09:44 PM MST #
Posted by Rick Hightower on March 02, 2005 at 12:26 AM MST #
Posted by 211.144.200.89 on March 02, 2005 at 02:27 AM MST #
Posted by Christopher K Koenigsberg on March 03, 2005 at 05:53 PM MST #
Posted by 204.114.53.254 on March 17, 2005 at 08:07 PM MST #
Posted by PJ Murray on April 06, 2005 at 03:37 PM MDT #
Posted by Matt Raible on April 06, 2005 at 04:07 PM MDT #
Posted by Gabriel on April 09, 2005 at 12:59 PM MDT #
Posted by Adam Waldal on June 10, 2005 at 02:14 AM MDT #
Posted by Adam Waldal on June 10, 2005 at 02:24 AM MDT #
thanks
Posted by abdullah beik on September 28, 2005 at 05:44 AM MDT #
Posted by Matt Raible on October 04, 2005 at 06:58 PM MDT #
Posted by Jeeva on January 20, 2006 at 05:15 AM MST #
Posted by Matt Raible on January 23, 2006 at 04:43 PM MST #
Here in my company, www.gamatechno.com, we are starting to use JEE as a production environment. But, because there are sooo many opts, three of us demonstrate the use of their options to implement some --very-- simple Guest Book application.
I opt to use Spring + Hibernate + Velocity (? .. JSF). But then again, after reading the opinions about iBatis, well, I was seduced (sad isn't it?).
Dear GOD, is there a way to make me confident of what I choose?
Well, I look at all the technologies use by www.alfresco.com, so... I opt that technologies too : Spring + Hibernate + JSF
So, Mr. Raible, ... can you ... well, help me????
With Regards,
Eko SW
P.S. : JSF Vs. Velocity/Freemarker , maybe I choose Velocity, because (they said) the separation of work between HTML Designer and JAVA programmer can be done easily.
Posted by swdev on August 08, 2006 at 10:35 AM MDT #
Both Spring MVC and WebWork allow you to use JSP, Velocity or FreeMarker. I'd recommend using JSP unless you have a good reason not too. JSP 2.0 is a must.
Posted by Matt Raible on August 09, 2006 at 01:52 AM MDT #
I'm doing a very simple web project that needs to get off the ground quickly, it's a project where our team (3 developpers) have BASIC experience in HTML, JSP, and database experience. We want to get a look on some nice technologies, but don't necessarily have a lot of time for a steep learning curve. What would you suggest : Struts vs Spring, iBatis vs Hibernate. Our application has simple CRUD operations and simple page flow.
Thanks.
Pascal.
Posted by Pascal on October 27, 2006 at 04:57 PM MDT #
From the choices you've given, I'd recommend Spring MVC over Struts. As far as iBATIS vs. Hibernate - I think iBATIS is easier to learn, but I continue to choose Hibernate for most of the applications I write. Then again, I've been using Hibernate since 2003. ;-)
Posted by Matt Raible on October 29, 2006 at 08:33 PM MST #
Long time no talk to...
I recently tried to use Hibernate as part of a new SOA architecture with a legacy model 1 JSP application. The legacy app had enormously long SQL statements and a very poor db schema. We ended up abandoning Hibernate. Ibatis made it easy for us to create CRUD DAOs and work with the existing schema mess. Creating dynamic finders were easy too. We're sold on Ibatis. It works really well with Spring.
I've heard Hibernate advocates claim you'll need hibernate for advanced use cases. I've not found that to be the case. I'm a big fan of KISS. Ibatis fits the bill. Hibernate is too complex and quirky. If you don't think so, read this page... http://hibernate.org/109.html From this URL it sounds like hibernate has not worked out some of the most basic persistence object identity issues. Problems like that make an application unstable at runtime, and are very difficult to solve.
If I was going to start a new app from scratch, and had the time to learn the "right way" to use Hibernate, I might take the plunge again. However, you've got to consider that others will follow in modifying your code, and they'll have to learn Hibernate too.
Another persistence framework to consider may be the one included with http://ofbiz.apache.org/ I don't think it's designed to be used stand-alone, but I think some projects have used it that way, notably Jira. It hides the underlying database the way Hibernate does, but it also adds db columns as needed.
I'd like to see a Java framework that dynamically builds CRUD (list and detail) as fast as plone/RoR/etc that includes security, optimistic locking, client-side validation, etc. I'm considering building a portlet for Liferay.com that allows you to build a CRUD portlet and edit it at runtime, adding table columns, etc.
Sorry for the long winded post. I've been thinking about this stuff a lot lately.
mike
Open Source Software Solutions
Posted by Mike Lawrence on January 30, 2007 at 02:21 AM MST #
Posted by pobs on January 31, 2007 at 01:17 PM MST #
Posted by A_flj_ on April 13, 2007 at 06:15 AM MDT #
Posted by Gaurav on May 10, 2007 at 09:51 PM MDT #
Posted by Matt Raible on May 25, 2007 at 04:10 PM MDT #
Posted by Luke on September 09, 2009 at 02:25 PM MDT #
Thanks for this great thread.
Just wondering in 2010 - Does the argument of this blog post still hold good in 2010 ?
Thanks
>>Hibernate works well when you control the data model, iBATIS works
>>well when you need to integrate with an existing database
Posted by Mathew on January 04, 2010 at 04:47 PM MST #
I don't know if anyone made some serious performance benchmarks...
I DID
Hibernate and Ibatis are pretty close when it comes down to insert and updates...
Although...
Select statements executed in iBATIS are 10X faster than Hibernate!!!
Why is that??
Maybe the 2.5MB of difference in jar size might be something to do. Hibernate has been trying to reach a broad audience with greater features, but at the end of the day, increasing complexity and code.
I would like to see a proper performance from Hibernate....
I'm finding a good place to post my findings...
Ciao
Posted by Andrea on April 08, 2010 at 07:58 PM MDT #
Posted by uberVU - social comments on April 08, 2010 at 10:03 PM MDT #
@Andrea...
That's some seriously sketchy logic...
iBatis is x mb on disk.
Hibernate is (x+2.5mb) mb on disk.
Therefore, iBatis is 10x faster than Hibernate for select statements.
Huh?
Any diagnostics? Proof? Because your conclusion there is about as valid as if you said "therefore, hamburgers with cheddar cheese on them are 10x better than those with pepperjack."
Posted by Bryan on April 09, 2010 at 01:33 AM MDT #
"Since the first version of Alfresco, Hibernate has been used to provide the object-relational mapping and data access layer against the underlying relational database. Hibernate proved invaluable in enabling us to rapidly build the early versions of Alfresco.
As the size of Alfresco deployments has grown, it's become more important for Alfresco to control the interaction between the application and the underlying database to ensure this is optimized for our use case. In Alfresco 3.4, we have moved away from using the generalized capabilities provided by Hibernate to a native mapping and data access layer developed by Alfresco using Apache iBatis. The new approach provides us with a much greater level of control over the data access layer so we can ensure it continues to scale and support the very large repositories and enterprise deployments that Alfresco is increasingly seeing."
source: http://wiki.alfresco.com/wiki/Alfresco_Community_3.4.a#Hibernate_Removal
Posted by gandra on October 08, 2010 at 08:08 AM MDT #