What is Hibernate

By | 2017-12-12T14:47:49+00:00 April 5th, 2015|Hibernate|0 Comments

In this tutorial, we are going to see what is hibernate , where do we use and advantages of hibernate over JDBC.

What is Hibernate ?

Hibernate is an open-source and light weight ORM framework. It acts as a middle layer between Java project and Database for transforming objects between them.

Hibernate is an ORM tool, which can be used for developing persistence layer of java projects.

Hibernate is a Non-Invasive framework. It means hibernate doesn’t force developers to extend or implement their classes from Hibernate API.

Hibernate can be used for developing both desktop and server side java based applications. Hence we don’t require a server (web/application) to work with hibernate.

Advantages of Hibernate :

  • Hibernate supports Inheritance, Associations and Collections.
  • Hibernate supports inheritance strategies, hence if we save the child class object, then the corresponding base class also saved in database.
  • Hibernate supports relationships like one-to-one, one-to-many, many-to-one, many-to-many.
  • Hibernate supports collection types like List, Set, Map.
  • In JDBC all exceptions are checked exception, so that developer need to handle these all exceptions. But in hibernate there were no checked exceptions, no need to care about exception handling. Hibernate has a translator which converts all checked exceptions to unchecked exceptions.
  • Hibernate has a capability to generate primary keys while store the data into the database. It provides different types of generator classes to generate primary keys.
  • Hibernate has its own query language i.e Hibernate Query Language (HQL) which is database independent.
  • Hibernate comes with a default cache provider, generally called it as first level cache.
  • Hibernate supports annotations apart from xml configurations.
  • Hibernate provides dialect classes, so we no need to write sql queries instead we can directly use the methods provided by the hibernate API.
  • Getting pagination in hibernate is quite simple.

References :

Hibernate Officials

Hibernate Documents

About the Author:

Hi Folks, you have reach this so far, that shows you like what you are learning. Then why don't you support us to improve for bettor tutorials by leaving your valuable comments and why not you keep in touch with us for latest updates on your favorite blog @ facebook , twitter , Or Google+ ,

Leave A Comment