hibernate显示查询执行时间 [英] hibernate show query execution time
问题描述
直到现在,我还没有找到安装hibernate或log4j来显示在hibernate中执行查询的时间。发现任何有趣的东西。
也许你们中的一些人可能会帮我解决这个问题吗? 有一个简单的方法(内置 hibernate
)来实现它。它在 3.5.4中由 HHH-3659 修复。
和 3.6.0.Beta1
。
为此,请使用:
- 登录包:
org.hibernate.stat
至少在INFO
和 - 设置hibernate属性:
hibernate.generate_statistics = true
然后将记录所有 SQL
,包括获取的行数和执行查询的时间。
此外,如果有兴趣,它还提供查询统计信息。要通过 JMX
公开它们并使用 JConsole
查看它们,可以使用 Hibernate JConsole插件
,可在以下网址找到: http://hibernate-jcons.sourceforge.net/
I was looking for setup hibernate or log4j to show me, how long are executed queries in hibernate, which are invoked by hql.
Till now i didn't found anything interesting.
Maybe some of you might help me with this issue ?
There is a simple way (built in hibernate
) to achieve it. It was fixed by HHH-3659 in 3.5.4
and 3.6.0.Beta1
.
To go for it, use:
- logging on the package:
org.hibernate.stat
at least onINFO
and - set hibernate property:
hibernate.generate_statistics=true
Afterwards all the SQL
s will be logged including the row count fetched and the time the query execution took.
Moreover if interested, it provides statistics on queries. To have them exposed via JMX
and see them using JConsole
, you can use Hibernate JConsole plugin
, available on: http://hibernate-jcons.sourceforge.net/
这篇关于hibernate显示查询执行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!