Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring JDBCTemplate VS Hibernate in terms of performance [closed]

In our project we have to decide between Spring JDBCTemplate and Hibernate.

I want to know which is better in terms of performance and implementation and design. and how?

like image 908
Bosco Avatar asked Aug 03 '12 07:08

Bosco


1 Answers

If you do all you can to make both implementations very fast, the JDBC template will probably be a bit faster, because it doesn't have the overhead that Hibernate has. But it will probably take much more time and lines of code to implement.

Hibernate has its learning curve, and you have to understand what happens behind the scenes, when to use projections instead of returning entities, etc. But if you master it, you'll gain much time and have cleaner and simpler code than with a JDBC-based solution.

I would say that in 95% of the cases, Hibernate is fast enough, or even faster than non-optimized JDBC code. For the 5% left, nothing forbids you to use something else, like Spring-JDBC for example. Both solutions are not mutually exclusive.

like image 197
JB Nizet Avatar answered Oct 12 '22 03:10

JB Nizet