Hibernate Tutorial «Prev  Next»

Hibernate Foreword

Requirement Analysis, Designing and Project Estimation

Abstract: Hibernate lets you develop persistent classes following common Java idiom -
including association, inheritance, polymorphism, composition and the Java collections framework.

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.

Introduction to Hibernate

Hibernate is an open source object/relational mapping tool for Java. Hibernate lets you develop persistent classes following common Java idiom - including association, inheritance, polymorphism, composition and the Java collections framework.
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. Hibernates goal is to relieve the developer from 95 percent of common data persistence related programming tasks.
Hibernate is Free Software. The LGPL license is sufficiently flexible to allow the use of Hibernate in both open source and commercial projects (see the LicenseFAQ for details). Hibernate is available for download at hibernate.org.
This tutorial aims to provide insight into Hibernate version 3.0RC and its usage

Main Features

Some of the main features of hibernate are listed below and we have tried to explain some of them in detail later in this tutorial.

Transparent persistence without byte code processing

  1. JavaBeans style properties are persisted
  2. No build-time source or byte code generation /processing
  3. Support for extensive subset of Java collections API
  4. Collection instance management
  5. Extensible type system
  6. Constraint transparency
  7. Automatic Dirty Checking
  8. Detached object support
Java Persistence with Hibernate

Object-oriented query language

  1. Powerful object-oriented query language
  2. Full support for polymorphic queries
  3. New Criteria queries
  4. Native SQL queries

Object | Relational Mappings

Three different O/R mapping strategies

Multiple-objects to single-row mapping

  1. Polymorphic associations
  2. Bidirectional associations
  3. Association filtering
  4. Collections of basic types
  5. Indexed collections
  6. Composite Collection Elements
  7. Lifecycle objects

Automatic primary key generation

  1. Multiple synthetic key generation strategies
  2. Support for application assigned identifiers
  3. Support for composite keys

Object/Relational mapping Definition and XML Mapping Documents

Human-readable format

XDoclet support

HDLCA (Hibernate Dual-Layer Cache Architecture)

  1. Thread safeness
  2. Non-blocking data access
  3. Session level cache
  4. Optional second-level cache
  5. Optional query cache
  6. Works well with others

High performance

  1. Lazy initialization
  2. Outer join fetching
  3. Batch fetching
  4. Support for optimistic locking with versioning/timestamping
  5. Highly scalable architecture

High performance

  1. No "special" database tables
  2. SQL generated at system initialization time
  3. (Optional) Internal connection pooling and PreparedStatement caching

J2EE integration

JMX support

  1. Integration with J2EE architecture (optional)
  2. New JCA support (Finish)

At the moment of observation, the wave function collapses to just a single outcome.