Hibernate (Java)

From Wikipedia, the free encyclopedia

Hibernate
Image:Hibernate.gif
Developed by Red Hat
Latest release 3.2.6.ga / February 8, 2008 (2008-02-08); 126 days ago
Written in Java
OS Cross-platform (JVM)
Platform Java Virtual Machine
Genre Object-relational mapping
License LGPL
Website http://www.hibernate.org

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.

Contents

[edit] 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.

[edit] History

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).

[edit] Application programming interface

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

[edit] 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).

[edit] 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.

[edit] See also

[edit] References

  • Christian Bauer, Gavin King: Java Persistence with Hibernate, Manning Publications Company, ISBN 1-932394-88-5
  • Christian Bauer, Gavin King: Hibernate In Action, Manning Publications Company, ISBN 1-932394-15-X
  • Will Iverson: Hibernate: A J2EE Developer's Guide, Addison Wesley Professional, ISBN 0-321-26819-9
  • James Elliott: Hibernate: A Developer's Notebook, O'Reilly, ISBN 0-596-00696-9
  1. ^ Jolt winners 2005

[edit] External links