What is the advantage of Hibernate over jdbc?

Showing Answers 1 - 8 of 8 Answers

raj shekar

  • Nov 20th, 2006
 

As such you cannot compare Hibernate with JDBC.

One uses JDBC calls internally in the Hibernate files to get connections for the Databases.

  Was this answer useful?  Yes

sandhya

  • Dec 18th, 2006
 

Hibernate is used to persist the objects in the database, but we have to use the jdbc to connect to database. JDBC is used to store the primitivies in the database.

Charanjeet

  • Jan 5th, 2007
 

Hibernate is basically a ORM tool which allows you to perform database activies without bothering about the Database change.

You dont need to change the SQL scripts if you change database.

Apart from that you dont need to write most of the SQL scripts for persisting ,deleting object and parsing the resultsets.With respect to perfomance, hibernate provide the capability to reduce the number of database trips by creating the betch processing and session cache and second level cache.

It also supports the transactions.

More then this all, it is very easy to make a cleaner seperation of Data Access Layer from usiness logic layer.

With all the capabilities mention above it is fast and easy to learn hibernate, develop application and maintain easily.

Sheeba Ashraf

  • Jan 6th, 2007
 

The core drawback of JDBC is that it doesn?tallow you to store objects directly to the database you must convert theobjects to a relational format. For instance, if you want to persist a newinstance of the Emp class to the database, you must first convert the Emp object to a SQL statement that can be executed on the underlyingdatabase.Similarly, when rows are returned from the database, you must converteach result row into an instance of Event.

  Was this answer useful?  Yes

Guest

  • Jan 11th, 2007
 

It is a ORM tool used for OR Mapping which is not possible using JDBC.

  Was this answer useful?  Yes

sumangattu

  • Jul 22nd, 2007
 

1) Hiberante is not tightly tied with any underlaying database.Where as JDBC is tighlty tield with the underlaying database.

"Write Once presist anywhere" using hibernate can achieved by changing the dialect in configuration xml file.where as in JDBC we need to change the code.

2)The automatic mapping of Java objects with database tables and vice versa is called Transparent Persistence. Hibernate provides transparent persistence and developer does not need to write code explicitly to map database tables tuples to application objects during interaction with RDBMS. With JDBC this conversion is to be taken care of by the developer manually with lines of code.

Advantages OF Hibernate:
- First of all will provide business entity form of representation of DB tables.
- Hibernate provides an interface to develop our application code which is not specific to any DB.
- It reduces the complexity of transforming out object form of Data to text form while storing to the DB and vice versa.
- It provides an easy way of implementation through xml where can change anything specific to DB and hence we need not change application files.


Hibernate Performance:
- Hibernate provides Cache mechanism to reduce the hits to DB. It provides two cache levels 1) first level cache (By Session object) 2) Second level cache (By Session factory object)
- It provides the abstraction to the transaction management through XMLs and Programmatic as well.
- Hibernate is also having a very good exposure towards maintaining joins, parent-child and inheritance relationships among POJOs with simple mechanisms.
- The other important feature of Hibernate is 'Lazy Initialization'. This feature enable us to get only the required object instead of fetching all the entities associated with that instead fetches them only on requesting by specifying the join in the queries.

  Was this answer useful?  Yes

Ballu Ashok

  • Jan 21st, 2010
 

Hibernate Advantages:

Productivity:
                Improves the productivity by eliminating the JDBC tedious code.
                It provides good API to most common CRUD operantions, so that we can eliminate most of JDBC code

Maintainability:
                1. No of lines code is decreased
                2. easier to understand the system.
                3. Hiberante lets  you concentrate on Business logic
                4. Change’s are easy to implement
                     For ex: If we add a property to Class, So we need not change the Persistence code 
                     to update according the change(Like ps.setString(n,”…”)
                5. Writing the code in less no of lines is also considered for measuring the complexity of Project.

Performance:
               
If we consider Budget and timeline, Hibernate is better.
                Caching Result: It provides Cache mechanism to reduce the hits to DB
                Caching Statements       

Vendor Independent:
        We  need not to change Persistency code depending on DB
        We can develop on less complexity db, can deploy in production on complex DB

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions