Hibernate Tutorial

❮ Previous Next ❯

Hibernate Introduction

Hii friends before going to know the details about hibernate, first of all we have to know what is JDBC and what are the disadvantages of JDBC...then we will know hibernate and why hibernate.

What is JDBC ?

JDBC(Java Database Connectivity) is a technology or we can say it is a simple java program when it execute, it will manage the relational database, that means it provides a set of Java API for accessing the relational databases from Java program. JDBC provides a flexible architecture to develop different database applications that can execute on different platforms.

In this tutorial i have given a depth concepts of Hibernate framework by taking varieties of examples. It was developed by Gavin King and had started in 2001. Now I am presenting disadvantages of JDBC and how hibernate is eliminating the disadvantages of JDBC.

  1. In JDBC, once a database connection is established then we have to close the connection explicitly, bcz JDBC is not responsible for this, otherwise there may be a chances of memory leak.

  2. So as a programmer we must close the connection.

  3. In JDBC we are writing Sql statements in various places, after the program creation if the table structure is modified due to any reason then the JDBC program doesn't work, again we have to modify and compile which is a complex issue.

  4. JDBC is not able to transfer objects directly. Here the data flow with in an application from class to class will be in the form of objects, but while storing data finally in a database using JDBC then that object will be converted into text.

  5. So these are the limitations. To overcome these, Hibernate came to the picture..

What is Hibernate

Hibernate is an ORM tool which make easy of java application to communicate with database. It simplifies the data creation, data manipulation and data access. It is a programming phenomenon which maps the object to the data stored in the database. Hibernate is a non-invasive framework, means it can not forces the programmers to extend/implement any class/interface, and it is lightweight due to POJO classes. Hibernate can run with in or without server. Hibernate is purely for persistence (to store/retrieve data from Database).


There are 4 layers in hibernate architecture java application layer, hibernate framework layer, backhand api layer and database layer. The Hibernate architecture includes many objects persistent object, session factory, transaction factory, connection factory, session, transaction etc. Following is a very high level view of the Hibernate Application Architecture.

Hibernate uses many objects like session factory, session, transaction etc. And existing Java API such as JDBC (Java Database Connectivity), JTA (Java Transaction API) and JNDI (Java Naming Directory Interface) internally.


A Session is an interface which is used to establish a connection with a database physically. The Session object is lightweight and designed to be instantiated each time an interaction is needed with the database. Persistent objects are saved and retrieved through a Session object. The session objects should not be kept open for a long time because they are not usually thread safe and they should be created and destroyed them as needed. The main function of the Session is to offer create, read and delete operations for instances of mapped entity classes. Instances may have one of the following form at a given point in time:

❮ Previous Next ❯

Follow Us


Popular Links

Contact Us

address Plot No-741,2ND Floor
Opp. Bhagabati Temple,Jayadev Vihar
      Email: info@silantechnology.com
      Phone: 0674-2361252
39877, sundale dr, apt#101, Fremont, California 94538, USA
       Phone: +1(262)388-7619

facebook twitter google linked in

© 2018 Silan Technology. All Rights Reserved