Home » Hibernate » Introduction to Hibernate Framework

Introduction to Hibernate Framework

What is Hibernate ?

Hibernate is a powerful and high-performance ORM tool.Hibernate maps Java classes to database tables and from Java data types to SQL data types.Hibernate framework simplifies the development of java application to interact with the database.

Hibernate maps the Java classes to the database tables. It also provides the data query and retrieval facilities that significantly reduces the development time.

Hibernate is purely for persistence (to store/retrieve data from Database) operation. Hibernate sits between traditional Java objects and database server to handle all the work in persisting those objects based on the appropriate O/R mechanisms and patterns.

When thinking in terms of Java as the programming language,the business logic of an application works with Objects of different class types. However when dealing with the data store,it's important to note that the tables of a database are not objects,which becomes an issue. This is where the concept of Object Persistence comes in.

Object Persistence deals with persistence in object oriented program such as java.It means determining how objects and their relationships are persisted in a relational database.

ORM Overview


Advantage of Hibernate Framework :

  • Opensource and Lightweight: Hibernate framework is opensource under the LGPL license and it is lightweight.

  • Database Independent query: HQL (Hibernate Query Language) is the object-oriented version of SQL. It generates the database independent queries. So you don't need to write database specific queries. Without Hibernate, If database is changed for the project, we need to change the SQL query as well that leads to the maintenance problem.

  • Fast performance: The performance of hibernate framework is fast because cache is internally used in hibernate framework.

  • Simplifies complex join: To fetch data form multiple tables is easy in hibernate framework.

Advantage of Hibernate over JDBC:

  • Hibernate is data base independent, same code will work for all data bases like ORACLE,MySQL ,SQLServer etc. In case of JDBC query must be data base specific.
  • You will get benefit of Cache. Hibernate support two level of cache. First level and 2nd level. So you can store your data into Cache for better performance. In case of JDBC you need to implement your java cache .

Previous Next Article

comments powered by Disqus