Hibernate - SPLessons

Hibernate Features

Chapter 3

SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

Hibernate Features

Hibernate Features

shape Features

The chapter demonstrates about Hibernate Features. Hibernate has its own Query language called Hibernate Query Language(HQL). Hibernate Queries are Database independent. HQL contains Database Independent Commands so if made any changes in the database, then also it will work as Hibernate Queries. Following are some of the Hibernate Features.

  • Hibernate contains Translator. Hibernate changes the Checked Exception into Unchecked Exception. Hibernate has the unchecked exceptions. So, no need to write the code in the try, catch and throws which is a good Hibernate Features. The programmer can’t handle the exceptions explicitly.
  • Hibernate provides Dialect classes. So, no need to write SQL Queries in Hibernate. Only use the instance methods, then the Hibernate automatically creates the Queries in Command prompt.
  • In the Hibernate, all the data will be stored in the table format. So, data is easily understandable by the user which is a good Hibernate Features.
  • While inserting a record into the table if not found the particular table in the database, then JDBC throws Exception like View not exist, but Hibernate will create the table for us.
  • Hibernate supports Inheritance which means if the derived class object is saved, then its base class object will also be stored in a database.
  • Hibernate has Caching mechanism. It reduces the number of round trips between Java application to DataBase. Then Hibernate performance will increase.
  • Hibernate supports automatic Versioning of rows, but JDBC doesn’t support Versioning.
  • Hibernate supports Association means the data can be stored in multiple tables using relationships.
  • Hibernate supports Annotations apart from XML.
  • Getting a pagination in Hibernate is very simple.
  • Hibernate is a light-weight Framework because Hibernate transfers POJO class from Java Application to the Database.
  • Hibernate supports Collections like List, Set, and Map. JDBC doesn’t support Collections.
  • In Hibernate, there is no need to create any Connection pool object. Only Hibernate-c3po.jar is used.

Following are the disadvantages of hibernate.


shape Key Points

  • Hibernate underpins log4j.
  • Hibernate can integrate with spring and Struts.
  • Object oriented query language.
  • Ability to integrate with J2EE.