在性能方面Spring JDBCTemplate VS Hibernate [英] Spring JDBCTemplate VS Hibernate in terms of performance

查看:123
本文介绍了在性能方面Spring JDBCTemplate VS Hibernate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的项目中,我们必须在Spring JDBCTemplate和Hibernate之间做出决定。



我想知道哪个更适合于速度,实施和设计。和如何?
<如果你尽一切努力使这两种实现速度非常快,那么JDBC模板可能会快一点,因为它没有Hibernate的开销。但它可能需要更多的时间和代码来实现。 Hibernate有它的学习曲线,你必须了解幕后发生的事情,何时使用投影而不是返回实体等等。但是如果你掌握了它,那么你与使用基于JDBC的解决方案相比,您将获得更多时间并获得更清晰,更简单的代码。


我想说在95%的情况下,Hibernate速度足够快,甚至比非优化的JDBC代码更快。对于剩下的5%,没有什么东西禁止你使用别的东西,比如Spring-JDBC。两种解决方案并不相互排斥。


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

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

解决方案

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.

这篇关于在性能方面Spring JDBCTemplate VS Hibernate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆