News:

GinGly.com - Used by 85,000 Members - SMS Backed up 7,35,000 - Contacts Stored  28,850 !!

Main Menu

Process of Hibernate

Started by Kalyan, Apr 24, 2008, 10:39 AM

Previous topic - Next topic

Kalyan

Process of Hibernate

Hibernate is an object-relational mapping (ORM) solution for the Java language: it provides an easy to use framework for mapping an object-oriented domain model to a traditional relational database. Its purpose is to relieve the developer from a significant amount of relational data persistence-related programming tasks.

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

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

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

EJB Vs Hibernate

The similarity is that with both you can persist a class in a DB; but it ends there. Period.
EJBs are supposed to be components, in the sense that they're not just one class, but a set of classes, descriptors (thats an XML and/or annotations in EJB 3) and usage and management contracts. All of this in order to allow a container (JBoss, Weblogic, etc.) to provide services to those components, and to be able to reuse and distribute this components. This services are, among others, transactions, concurrent access control, security, instance pooling, etcetera.

Hibernate is "just" an ORM (Object/Relational Mapping) tool. Quick and dirty, this means you can store an object tree belonging to an class hierarchy in a relational DB without writing a single SQL query. But no transaction control, no instance pooling, no concurrency control, and certainly no security.

On the other hand, inheritance and polymorphism are IMPOSSIBLE out of the box with EJB. A quite big drawback.

The big issue seems to be this days that there's no intersection between Hibernate and EJB's funcionality. What you can with one you can barely do with the other. So EJB 3 is on its way to fill this gap and solve all of our problems. The spec is a draft for the time being, but there are some implementations, already.

That's the difference between Hibernate and EJB, in a nutshell.

NHibernate is an Object-relational mapping (ORM) solution for the Microsoft .NET platform: it provides an easy to use framework for mapping an object-oriented domain model to a traditional relational database. Its purpose is to relieve the developer from a significant amount of relational data persistence-related programming tasks.

NHibernate

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

NHibernate is a port of the popular Java O/R mapper Hibernate to .NET. Version 1.0 mirrors the feature set of Hibernate 2.1, adding a number of features from Hibernate 3. NHibernate 1.2.0, released May of 2007, introduces many more features from Hibernate 3 and support for .NET 2.0, stored procedures, generics and nullable types. NHibernate 2.0 is currently under development and will provide most of Hibernate 3 features.