Hibernate Architecture

By | | Updated : 2021-03-09 | Viewed : 11130 times

Hibernate architecture

Here we are going to discuss about Hibernate (ORM tool), architecture in brief and its main classes and interfaces.

Hibernate Introduction

Hibernate is an ORM, which is an Object Relational Mapping tool for java Programming Language. It provides a Framework to map an object oriented domain model with relation database table. Hibernate also can handle Object relational impedance mismatch. Hibernates primary feature is mapping from Java classes to database tables, and mapping from Java data types to SQL data types and vice versa. Hibernate also provides data query and retrieval facilities. It generates SQL calls and relieves the developer from the manual handling and object conversion of the result set. So the development time for application will be significantly reduced. Hibernate converts the data between Data access layer (Java) and Database. It will help us to remove Specific Database SQL.

Hibernate Architecture

Please find below given diagram visualized for Hibernate Architecture.

Hibernate architecture

We will discuss here main interfaces of Hibernate. Please find the below given classes for the same.

Main interfaces

  • Session Factory

  • Session

  • Transaction

Session Factory:

A session factory is thread safe and very expensive also. So we have to create the only one Session Factory per one database. It will create multiple session instances, which will be used for executing the Database queries.


A Single threaded and short lived object which will used for executing a query. Here the session contains the JDBC connection object. So we need to session to execute every single database transaction. It will be behave factory for Transaction.


A single threaded, short lived object is Transaction. Each Database transaction, We need to create separate Transaction.

We Learned hibernate advantages over JDBC. We will discuss here hibernate first application in next chapter.

Leave A Reply