Spring JDBCTemplate VS Hibernate in terms of performance

来源:互联网 发布:js闭包的好处 编辑:程序博客网 时间:2024/05/17 06:06

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.

0 0