如何使用休眠记录最终的SQL查询 [英] How to log final SQL queries with hibernate

查看:103
本文介绍了如何使用休眠记录最终的SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用休眠模式时是否可以不记录HQL查询,而是记录最终查询.我的意思是,发送到数据库的那个.我尝试了不同的日志级别,但是还没有看到.我认为调试一些问题会很有用.

Is it possible to log not HQL queries but final queries when using hibernate. I mean, the one that is sent to the database. I've tried different log level but I haven't seen it. And in my opinion it would be useful to debug some issues.

非常感谢您.

推荐答案

是的,有可能.这就是 hibernate.show_sql属性可以.您还可以使用记录配置来更好地控制:

Yes, it's possible. That's what the hibernate.show_sql property does. You may also have finer control using the logging configuration:

org.hibernate.SQL           Log all SQL DML statements as they are executed
org.hibernate.type          Log all JDBC parameters
org.hibernate.tool.hbm2ddl  Log all SQL DDL statements as they are executed

这篇关于如何使用休眠记录最终的SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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