Tech Manthan

April 30, 2007

Hibernate – An Object Relational Mapping (ORM) solution

Filed under: Java Manthan — sandipdavda @ 12:02 pm

Hibernate

By Anju Ravindran

Hibernate is an object-relational mapping (ORM) solution for the Java language. It is free as open source software that is distributed under the GNU Lesser General Public License. It provides an easy to use framework for mapping an object-oriented domain model to a traditional relational database. The purpose of Hibernate is to relieve the developer from a significant amount of common data persistence-related programming tasks. Hibernate adapts to the developer’s development process, whether starting from scratch or from a legacy database. The main disadvantages of java CMP entity beans include:

  • CMP entity beans are slow
  • They must reside inside some Application Server
  • They require special method names.
  • They are not serializable

Hibernate not only takes care of the mapping from Java classes to database tables (and from Java data types to SQL data types), but also provides data query and retrieval facilities and can significantly reduce development time otherwise spent with manual data handling in SQL and JDBC. Hibernate generates the SQL calls and relieves the developer from manual result set handling and object conversion, keeping the application portable to all SQL databases. Hibernate provides transparent persistence for “Plain Old Java Objects”; the only strict requirement for a persistent class is a no-argument constructor, not compulsorily public. Hibernate is typically used both in standalone Java applications and in Java EE applications using servlets or EJB session beans.


Hibernate Core for Java key features:

  • Natural programming model – Hibernate supports natural OO idiom; inheritance, polymorphism, composition and the Java collections framework

  • Support for fine-grained object models – a rich variety of mappings for collections and dependent objects

  • No build-time byte code enhancement – there’s no extra code generation or bytecode processing steps in your build procedure

  • Extreme scalability – Hibernate is extremely performant, has a dual-layer cache architecture, and may be used in a cluster

  • The query options – Hibernate addresses both sides of the problem; not only how to get objects into the database, but also how to get them out again

  • Support for “conversations” – Hibernate supports both long-lived persistence contexts, detach/reattach of objects, and takes care of optimistic locking automatically

  • Free/open source – Hibernate is licensed under the LGPL (Lesser GNU Public License)

  • EJB 3.0 – Hibernate implements the Java Persistence management API and object/relational mapping options, two members of the Hibernate team are active in the expert group

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.