hibernate显示查询执行时间

编程入门 行业动态 更新时间:2024-10-27 10:25:15
本文介绍了hibernate显示查询执行时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

直到现在,我还没有找到安装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显示查询执行时间

本文发布于:2023-10-17 06:26:05,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:执行时间   hibernate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!