How to log final SQL queries with hibernate

2019-07-17 16:13发布

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.

1条回答
Lonely孤独者°
2楼-- · 2019-07-17 16:50

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
查看更多
登录 后发表回答