ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Which is best? hibernate vs jdbc?

user-image
تم إضافة السؤال من قبل Shahbaz Awan , M2M IoT Software Architect , Wadi Makkah
تاريخ النشر: 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
من قبل 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
من قبل 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
من قبل Bassem Zohdy , Java Chief Architect , Crossover

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
من قبل 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.....

المزيد من الأسئلة المماثلة