Java2all.com  




Share This Topic -

Java Hibernate introduction:

Hibernate is an open source object relational mapping tool used in Java programming.

Hibernate allows data to be inserted, removed or changed in a database without paying a lot of attention to how it gets there.

Hibernate was founded by Mr. Gavin King, an Australian developer who needed to solve a problem and ended up creating Hibernate, an open source tool that is amazingly useful with JAVA.

The central idea of Hibernate is this: “JAVA programmers are used to creating POJOs [Plain Old Java Objects] in Java. 

So why do they need a second language like SQL, to put or apply (persist) those POJOs into the database? ”

Hibernate does object-relational persistence and querying.

That means Hibernate puts whole objects into a relational database and pulls whole objects out of a relational database.

When Can I Use Hibernate?

Hibernate can be used in any Java program that needs to access a relational database. Hibernate does not need an application server to run.

When Should I Use Hibernate? 

There are main three points at where Hibernate is use if :

(1)There is a non-trivial application

(2)There are more than 10 tables in the relational DB.

(3)The application uses an object-oriented Domain Model.

If the application does a lot of business logic—and does much more than just display tables of data on a webpage—then it is a good candidate for Hibernate.

Hibernate is best in applications with complex data models, with hundreds of tables and complex inter-relationships.

So Hibernate maps the java classes to the database tables. It also provides the data query and retrieval facilities that reduce the development time. 

Note: 
Domain Model means an object model of the domain that incorporates both behavior and data

Note:
Hibernate is most useful with object-oriented domain modes and business logic in the Java based middle-tier.

It is not the best solutions for data centric application that only uses the stored-procedures to implement the business logic in database.