Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Which is best? hibernate vs jdbc?

user-image
Question added by Shahbaz Awan , M2M IoT Software Architect , Wadi Makkah
Date Posted: 2013/10/08

Hibernate.

Bcz, its supports ORM, Transaction management, better performance, thread safe session factory, simple and readability, several cache memory system, Criteria APIs, etc.

.With JDBC  mapping between java objects and database tables is done manually, developer needs to handle it. Unlike Hibernate. Hibernate is more flexible and mapping is done using XML files. So developer does not need to write code for this using hibernate.

There is also caching. With JDBC caching is maintained by handcoding.Whereas hibernate   handles it by itself and allows the developer to focus more on the business logic rather then coding.

 

Ali Badr
by Ali Badr , Senior Java Developer , Technical Solution Company

using hibernate is converting the database table2 be used like Object and make it's easier in OOP.Also using hibernate is way from maintanable code if you want2 change the database.Caching in hibernate is also good for performance. May be JDBC is more easier in using in developement not like hibernate which other can see it more complex.

according2 complex queries in hibernate u can write complex queries using hql or SQL.

Ajith Fernandez
by Ajith Fernandez , Software Engineer , Nayasoft Solutions Pvt.ltd

Hibernate code will work well for all databases, for ex: Oracle,MySQL, etc. where as JDBC is database specific.

No knowledge of SQL is needed because Hibernate is a set of objects and a table is treated as an object, where as to work with JDBC, one need to know SQL.

Query tuning is not required in Hibernate. The query tuning is automatic in hibernate by using criteria queries, and the result of performance is at its best. Where as in JDBC the query tuning is to be done by the database authors.

With the support of cache of hibernate, the data can be placed in the cache for better performance. Where as in JDBC the java cache is to be implemented.

Bassem Zohdy
by Bassem Zohdy , Senior Software Architect , HelpAG

using any ORM framework is helping java developer to be more focus on the business logic than, the details of data base details, as you are dealing with domain objects and its provide you transaction managment and caching, and other utiities, but if you like to use JDBC I prefer to use Spring JDBCTemplates as it is helping you and remove to much headache of managing transactions and copy and past fields mapping, and connection managment.

Shahbaz Awan
by Shahbaz Awan , M2M IoT Software Architect , Wadi Makkah

jdbc is good whereever you require complex quries whereas hibernate is good where you dont require complicated quiries and avoid queries to persist your objects directly on to the database.....

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.