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

本文是小编为大家收集整理的关于如何用hibernate记录最终的SQL查询的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

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

非常感谢.

推荐答案

是的,这是可能的.这就是记录配置, :

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

本文地址:https://www.itbaoku.cn/post/1575048.html

问题描述

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.

Thank you very much.

推荐答案

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