Friday, June 24, 2011

Why should you use Hibernate?

There are couple of reasons to use hibernate:
Reason 1 - Performance

Hibernate generates very efficient queries very consistently. However, that is only the begining of the performance story. Hibernate employs very agressive, and very intelligent first and second level caching strategy. This is a major factor in acheiving the high scalability.
Hibernate spares you a unnecessary database calls. So all these lookup tables, and rarely changing data can get cached, and much more.
It allows you to cache how much you want, and it can be very intelligent with write-backs. Furthermore, it integrates well with the major open source (OSCache, EHCache, JBossCache, ...) and commercial caching products such as Tangosol giving you an opportunity to use even more sophisticated features that come with these products.

Reason 2 - Effective Cross-Database Portability

Hibernates portability accross the relational databases is amazing.
It is literally one configuration paramter change. You only have to change the database dialect. This property was especially helpful in my previous company because we used to deploy to wide range of databases since had bunch of extra licenses, so we never knew if the DBA manager would allocate us a Sybase or DB2. So we used to develop on MySQL, and then deploy on whatever. The only change was the change of the dialect - one line change in the configuration file.
That was it!

Reason 3 - Developers' Productivity

I have to admit that Hibernate ,like other sophisticated frameworks, has a steep, but short learning curve, but once you got it - you got it. It becomes a breeze to work with, and it feels like a magic.

But who shouldn't use hibernate?
If your project is using lots of stored procedures, please don't use Hibernate.

No comments:

Post a Comment

Chitika