【发布时间】:2012-07-27 14:04:55
【问题描述】:
是否可以在使用休眠时记录不是 HQL 查询而是最终查询。我的意思是,发送到数据库的那个。我尝试了不同的日志级别,但我没有看到它。在我看来,调试一些问题会很有用。
非常感谢。
【问题讨论】:
是否可以在使用休眠时记录不是 HQL 查询而是最终查询。我的意思是,发送到数据库的那个。我尝试了不同的日志级别,但我没有看到它。在我看来,调试一些问题会很有用。
非常感谢。
【问题讨论】:
是的,这是可能的。这就是hibernate.show_sql property 所做的。您还可以使用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
【讨论】: