Friday, June 27, 2008

Hibernate (Java)

Hibernate (Java)

Written in Java
OS Cross-platform (JVM)
Platform Java Virtual Machine
Genre Object-relational mapping


Hibernate is an object-relational mapping (ORM) library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database. Hibernate solves Object-Relational impedance mismatch problems by replacing direct persistence-related database accesses with high-level object handling functions. The Hibernate 2.1 framework won a Jolt Award in 2005 [1]

Hibernate is free as open source software that is distributed under the GNU Lesser General Public License.

Feature summary

Hibernate's primary feature is mapping from Java classes to database tables (and from Java data types to SQL data types). Hibernate also provides data query and retrieval facilities. 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, with database portability delivered at very little performance overhead.

Hibernate provides transparent persistence for Plain Old Java Objects (POJOs). The only strict requirement for a persistent class is a no-argument constructor, not compulsorily public. (Proper behavior in some applications also requires special attention to the equals() and hashCode() methods.[1])

Hibernate provides a dirty checking feature that avoids unnecessary database write actions by performing SQL updates only on the modified fields of persistent objects.

Hibernate can be used both in standalone Java applications and in Java EE applications using servlets or EJB session beans.


Hibernate was developed by a team of Java software developers around the world led by Gavin King. JBoss, Inc. (now part of Red Hat) later hired the lead Hibernate developers and worked with them in supporting Hibernate.

The current version of Hibernate is Version 3.x . This version has new features like a new Interceptor/Callback architecture, user defined filters, and JDK 5.0 Annotations (Java's metadata feature). Hibernate 3 is also very close to the EJB 3.0 specification (although it was finished before the EJB 3.0 specification was released by the Hibernate wrapper for the Core module which provides conformity with the JSR 220 JPA Entity Manager standard).

Application programming interface

The Hibernate API is provided in the Java package org.hibernate.

org.hibernate.SessionFactory interface

References immutable and threadsafe object creating new Hibernate sessions. Hibernate-based applications are usually designed to make use only of a single instance of the class implementing this interface (often exposed using a singleton design pattern).

org.hibernate.Session interface

Represents a Hibernate session i.e. the main point of the manipulation performed on the database entities. The latter activities include (among the other things) managing the persistence state (transient, persisted, detached) of the objects, fetching the persisted ones from the database and the management of the transaction demarcation.

Session is intended to last as long as the logical transaction on the database. Due to the latter feature Session implementations are not expected to be threadsafe nor to be used by multiple clients

No comments: