Hibernate is an ORM or Object Relational Mapping (ORM) tool. It is an ORM solution for java developers to
map java objects to relational database tables and java data types to SQL data types.
Hibernate is a layer which sits between java objects and the database, in other words it is used in the
data layer of applications. Hibernate handles all the tasks involved in persisting objects. Persistence is
a process of storing the data to some permanent medium and retrieving it back at any point of time even
after the application that had created the data ended. It implements Java Persistence API (JPA).
Below diagram is self explanatory as it clearly tell us at which part of application hibernate comes into picture.
Advantages of Hibernate
- The main advantage is that it relieves developers from writing messy SQL.
- Hibernate takes care of mapping Java classes to database tables using XML files and without writing any line of code.
- It provides simple APIs for storing and retrieving Java objects directly to and from the database.
- At a later point of time if the user wants to change the database then the user only need to change the configuration file, leaving the rest of the code untouched.This is possible because the ORM framework generates data base specific code for us.
- Hibernate improves the performance by using caching, lazy loading etc.
No comments:
Post a Comment