Thursday, May 5, 2011

Hibernate introduction

Hibernate, created by Gavin King, known as the best and dominated object/relational persistence (ORM) tool for Java developers (Now is support .NET). It provides many elegant and innovative ways to simplifies the relational database handling task in Java.
Hibernate is great at a lot of things, but its something that needs to be used appropriately.
Hibernate lets you develop persistent classes following common Java idiom(though now supported for .net as NHibernate) - including association, inheritance, polymorphism, composition and the Java collections framework. The Hibernate Query Language, designed as a "minimal" object-oriented extension to SQL, provides an elegant bridge between the object and relational worlds. Hibernate also allows you to express queries using native SQL or Java-based Criteria and Example queries.

The main objective of Hibernate is to relieve the developers from manual handling of SQLs,JDBC APIs for resultsets handling and it helps in keeping your data portable to various SQL databases,just by switching the delegate and driver details in hibernate.cfg.xml file.
Hibernate offers sophisticated query options, you can write plain SQL, object-oriented HQL (Hibernate Query Language), or create programmatic criteria and example queries. Hibernate can optimize object loading all the time, with various fetching and caching options.
Main Features of Hibernate

Some of the main features of hibernate are listed below :
Transparent persistence without byte code processing
  • Transparent persistence
  • JavaBeans style properties are persisted
  • No build-time source or byte code generation / processing
  • Support for extensive subset of Java collections API
  • Collection instance management
  • Extensible type system
  • Constraint transparency
  • Automatic Dirty Checking
  • Detached object support
Object-oriented query language
  • Powerful object-oriented query language
  • Full support for polymorphic queries
  • New Criteria queries
  • Native SQL queries
Object / Relational mappings
Three different O/R mapping strategies
  • Multiple-objects to single-row mapping
  • Polymorphic associations
  • Bidirectional associations
  • Association filtering
  • Collections of basic types
  • Indexed collections
  • Composite Collection Elements
  • Lifecycle objects
Automatic primary key generation
  • Multiple synthetic key generation strategies
  • Support for application assigned identifiers
  • Support for composite keys
Object/Relational mapping definition
  • XML mapping documents
  • Human-readable format
  • XDoclet support
HDLCA (Hibernate Dual-Layer Cache Architecture)
  • Thread safeness
  • Non-blocking data access
  • Session level cache
  • Optional second-level cache
  • Optional query cache
  • Works well with others
High performance
  • Lazy initialization
  • Outer join fetching
  • Batch fetching
  • Support for optimistic locking with versioning/timestamping
  • Highly scalable architecture
  • High performance
  • No "special" database tables
  • SQL generated at system initialization time
  • (Optional) Internal connection pooling and PreparedStatement caching
J2EE integration
  • JMX support
  • Integration with J2EE architecture (optional)
  • New JCA support

No comments:

Post a Comment