Hibernate:

Hibernate is a frame work. Hibernate frame work is used to develop a java application to interact with database server.


A frame work is a piece of software this piece of software contains solutions from commonly repeatedly occurred problems occurs multiple projects.

*Hibernate is a frame which is used to interact with database server:

There are so many frameworks are available in the market there are some of struts, springs, JSF etc.
Struts, spring frame works are used to develop web-based applications.

Advantages of Hibernate(Over come to JDBC Program) 


1.                                                                             Hibernate is a technology or a framework which is used to interact with database server this framework resolves all the problems of JDBC. In a project if he tries to use hibernate frame work if he develop the project quickly.
                                               
a.  As part of JDBC we have to write lot of code to hardly checked Exception.


2.                                                                             As part of Hibernate we no need to provide the code to handle checked Exception.

3.  If we use JDBC, the programmer is responsible to register the driver and get the connection. Programmer must provide the code to close the connection. As part of Hibernate he is responsible to open the connection and close the connection.


4.  As part of Hibernate it’s only starts the transaction and ends the transaction. Hibernate internally uses JTA (Java Transaction API). To start the transaction and end the transaction.

5.  Hibernate support internal connection provides Hibernate uses C3B connection pool. DBCP connection pool. If we want to use external connection pool like web-logical we can configure it. If we use JDBC we have to provide the code to handle database specific error code.


6.  If we use Hibernate we no need to provide the code to handle database specific errors.

7.                                                                             Hibernate supports it’s own query language HQL (Hibernate Query language) to resolve the problems of same java application to interact with multiple DB Servers without changing the queries.


8.                                                                             In case of JDBC we have to provide the code to remove the hard coding. In case of Hibernate we provide the details in Hibernate configuration by reading the details from configuration file (.XML). It will interact with multiple Database Server.

9.                                                                             If we use JDBC, programmer is responsible to write the code to generate the primary key values. As part of Hibernate they have provided pre-defined class to generate primary key values.


10.                                                                         By using Hibernate we can represent the queries in the form of object or we can use criteria API. As part of Hibernate we can achieve polymorphism between the tables and we can achieve association also.
11.                                                                         By using JDBC we can’t transfer result set object from one program to another program (result set can’t be transferable) to resolve this problem we have to provide the code to retrieve data from result set object and store it in array list object if we use Hibernate. Hibernate does all these work.

12.                                                                         *we have the technology like EJB to interact with DB Server we can’t run EJB Application without EJB container. We can’t use EJB’s in all type of application we can resolve all these problems we can use Hibernate.

1 comments: