Previous | Home | Next |
Hibernate is an ORM (Object relational mapping) framework is technique to map data of object domain into data of relational domain. Application developer need to persist data into database and need to fetch persisted data from database.
Main facilility of an ORM framework is to persist object and their relations into the database on behalf of application developer.For this ORM framework required configuration and mapping information whch can be provided in form of xml or anotaion.
Hibernate not only takes care of the mapping from Java classes to database tables (and from Java data types to SQL data types),but also provides data query and retrieval facilities and can significantly reduce development time otherwise spent with manual data handling in SQL and JDBC.
As we all know that Hibernate is a high performance Object/Relational persistence and query service which is licensed under the open souce GNU Lesser General Public License (LGPL) and it is free to download. We can say that Hibernate not only takes care of mapping form java classes to database table (and from java data types to SQL data types) but also provides data query and retrieval facilities.
Advantages of Hibernate
The Advantages of hibernate are given below:
- First advantages of hibernate is that it supports to Inheritance, Association, Collections.
- Using Hibernate Whenever we save the derived class object, then its base class object Will be also be stored into the database. It means we can say that Hibernate support to inheritance.
- One is major property of hibernate is that is has relation One-To-Many, One-To-One, Many-To-One, Many-To-Many and last is Many-To-Many-To-Many.
- As we are saying that it use the collection that is like List, Set, Map(Only for new Collections)
- We all know that in the JDBC all exception are checked exception, so we must need to write code in try and catch block and throws. But in Hibernate we only have Un-Checked exceptions, so no need to write try and catch block and also no need to throws. Basically in Hibernate we have the translator which converts checked to Un-Checked.
- One is also major advantages is that hibernate has the capability to generate primary key automatically while we stores the records into the database.
- Hibernate has its own query language like as hibernate query language which is database independent.
- While we are inserting any record and if we don't have any perticular table in the database JDBC will rise and error like "View not exist" and throws exception but in the case of hibernate if it not found any table in the database this will create the table for us.
- As we know that hibernate supports caching mechanism by this the number of round trips between and application and the database will be reduced, by using caching technique an application performance will be increased automatically.
- Hibernate support to annotations, apart from XML.
- Hibernate provides Dialect class, so we no need to write sql queries in hibernate, instead we use the methods provides by that API.
- Getting pagination in hibernate is quite simple.
Disadvantages of Hibernate
- We don't think there will be any kind of disadvantages in hibernate.
- But you know hibernate is more slower that pure JDBC, actually the reasion being hibernate used to generate many SQL statements in run time, but as i found this is not a advantages.
- But there is major disadvantages, which is boilerplate code issue, actually we need to write same code in serval files in the same application, but spring eliminated this.
Previous | Home | Next |