开发者

How to log values that Hibernate binds to prepared statements?

开发者 https://www.devze.com 2023-01-16 03:07 出处:网络
How can I make Hibernate log the values it binds to prepared statements? If I set property hibernate.show_sql=true I get following kind of logging:

How can I make Hibernate log the values it binds to prepared statements?

If I set property hibernate.show_sql=true I get following kind of logging:

insert into tablename (field1, field2) values (?, ?)

I'd like also to kno开发者_运维技巧w what values are bound to question marks.

I am using Hibernate 3.2.7.ga.


You need to set the following logging category to TRACE

org.hibernate.type

And personally, I don't use the show_sql property, I work with DEBUG enabled for the category:

org.hibernate.SQL

This way, I have a single place to configure everything.

Reference

  • Hibernate Core Reference Guide
    • 3.5. Logging
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号