Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

Hibernate Architecture

In this tutorial we are going to describe hibernate architecture with example.


When should you use Hibernate? What's new in Hibernate 5? How much time it takes to learn Hibernate? Hibernate envers custom revinfo table Hibernate 5 Envers Hibernate Envers get all revisions Hibernate Examples Hibernate 5 build SessionFactory Example Hibernate 5 SessionFactory Example Hibernate 5 Annotation Example How to download Hibernate 5.x? Hibernate 5 Features Hibernate 5 Tutorials Learning Hibernate ORM - Free Training/Tutorial videos of Hibernate ORM with Java How to write hello world example program in Hibernate? How to create one to one relationship in Hibernate 4 with Annotation? How to calculate minimum in Hibernate using the min() Function Hibernate ORM 4.2.21.Final Released - Create CURD application in latest Hibernate Hibernate ORM 4.2.21 Tutorial - Learn Hibernate ORM Framework Hibernate Error: Failed to create sessionFactory How to create Hibernate Project in Eclipse? Examples of Hibernate Criteria Query Hibernate ORM 4.3.6.Final released Hibernate ORM 4.2.14.Final released Hibernate 4.3.4 Released: Hibernate 4.3.4.Final Maven dependency Hibernate association and join example Learn Hibernate programming with Examples Introduction to Hibernate Framework Hibernate Tutorial: Learn Hibernate with examples Hibernate 4.3 Hello World: Example Hibernate ORM 4.3.1.Final released How to create SessionFactory in Hibernate 4.3.1? Hibernate 4 Hello World: Example of Hello World program Hibernate 4 create Session Factory: Example of creating Session Factory in Hibernate 4 Hibernate 4.3 and JPA 2.1 Example What is Hibernate in Java? Hibernate Overview and Architecture What is JPA 2.1? Hibernate 4.3.0.Final Maven dependency Hibernate 4.3 ORM Features Hibernate 4.3 Tutorial Hibernate Criteria average example Hibernate Criteria load all objects from table Hibernate Criteria Hibernate ORM 4.3.0.Final released Hibernate beginner tutorial Hibernate Session.delete() Example Hibernate save or update method example Hibernate Load Example Hibernate save Example - Rose India Hibernate 4 tutorials

Hibernate Architecture

In this tutorial we are going to describe hibernate architecture with example.

Hibernate Architecture :

It is layered architecture. So you are away from the underlying APIs. Hibernate is written in java and you can configure it in two ways-
first by using configuration file named hibernate.cfg.xml and another by using *.hbm.

Diagram : Here is diagram of Hibernate architecture.

The above diagram shows how hibernate uses database and configuration data to provide persistent object to your application.

JDBC is not the only technology used between Hibernate and database server  but there are  more java APIs like JTA(Java Transaction API),JNDI(Java Naming and Directory Interface).
Now we are going to give you brief description of architecture -

Hibernate Configuration :

Configuration class perform two operations. You can say Configuration class has two component-database connection and class mapping setup.
The first component is handled through one or more configuration files supported by Hibernate. These files are hibernate properties and hibernate.cfg.xml.
Second component that is class mapping, it creates the connection between java classes and database tables.

Hibernate SessionFactory : 

For SessionFactory import org.hibernate.SessionFactory. SessionFactory is factory for Sessions and is created in your configuration file.
When your application start ,it is created. For each database ,there is one SessionFactory.
If you are using more than one database you need to create multiple SessionFactory object. It is thread safe object.
It also maintains second level cache of data that is reusable between transactions at a process or cluster level but it is optional.

Hibernate Session :

For Session Object import org.hibernate.Session. It is used for database connection. It is very lightweight and
single-threaded. It lives for short time, represents conversation between the application and the persistent store.
Session object is used for saving and retrieving persistent objects. Session object is not thread safe so do not open it for long time.
You can create and destroy as your need.

Hibernate Transaction :

For Transaction import class org.hibernate.Transaction.It is optional.
Transaction is single threaded and short-lived object ,used for a unit of work with the database.
Most of the RDBMS supports transaction functionality. Transaction manager handle your transactions.

Hibernate Query :

Hibernate provide simple SQL  ,native query and HQL for  performing different database operations. At last execute query to complete your operation.

Hibernate Criteria :

 Hibernate provide a high object oriented concept of criteria. Criteria objects are used to perform database operations
under object oriented concepts.



Share on Google+Share on Google+

Hibernate Architecture

Posted on: July 20, 2012 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: Hibernate Architecture  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image