直到现在,我还没有找到安装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插件,可在以下网址找到: hibernate-jcons.sourceforge/
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 on INFO and
- set hibernate property: hibernate.generate_statistics=true
Afterwards all the SQLs 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: hibernate-jcons.sourceforge/
更多推荐
hibernate显示查询执行时间
发布评论