– Hibernate vs. Rails: The Persistence Showdown

Lucas Jellema 1

An interesting article comparing two OO/R frameworks: Hibernate and RAILS. It gives a good indication of what you should look for when investigating OO/R mapping/persistency frameworks. – Hibernate vs. Rails: The Persistence Showdown

You could apply this same kind of analysis to alternatives such as: Toplink, Ibatis, OJB, JDO, EJB 3.0, Oracle ADF Business Components etc.

By the way, the main conclusion is: Hibernate is more mature and has features required for large, scalable applications. On the other hand, RAILS is simple to learn and very quickly gets you going, especially on smaller endeavours.

Beyond the basics, Hibernate adds quite a few more mapping types (I documented a complete catalog of examples with over 20 mappings in Hibernate Quickly), including different inheritance strategies, custom user types, and maps of entity or simple types. While it’s simpler to specify and use simple associations in Rails than in is in Hibernate, but there is less you can do with them. If you stick to the simple cases like single tables with a few associations, and you name your tables and columns right, Rails will likely do just fine, but for more complicated object models, Hibernate will be a better choice.

Rails and Hibernate are very different when it comes to query languages. While its not possible to do an exhaustive comparison of their query languages, generally selects for single objects/tables will be quicker and easier for Rails, and anything join related is better suited for Hibernate. Rails use SQL, which is familiar to most developers, while Hibernate offers HQL a OO query language that developers will need to learn. In addition, Hibernate offers quite a few more tuning opportunities, providing the necessary ORM mechanisms, like outer join fetching, configurable lazy fetching and second level caching. This further supports the theory that Rails is likely suitable for smaller projects, but its ORM layer lacks a number of the essential features that will allow it to scale up to larger projects.

It reminds me that we should take a look at Ruby. Too much buzz to remain ignorant.

One thought on “ – Hibernate vs. Rails: The Persistence Showdown

  1. Hibernate offers its Hibernate Query Language, but you can use SQL too. You may need to learn HQL if you’re working on an existing project that uses it, but if you’re writing your own Hibernate application from scratch, you can ignore HQL entirely.

Comments are closed.

Next Post

Knowledge Center on Web & Java

AMIS has several Knowledge Centers, each around a technology theme. The current themes are: Web & Java (Oracle) Server Development & Programming Languages Oracle Development Tools Database Administration and Application Server Administration Technical Architecture In addition we have groups concerned with Project Management and Analysis & Business Consultancy. We have […]
%d bloggers like this: