Logging SQL queries with Hibernate

I’ve just realized that several visitors landed here searching for this information…

Enabling SQL logging with hibernate only requires to use the property:

hibernate.show_sql = true

(more information on chapter 3 of the manual, table 3.3)

However, some preffer tweaking the log4j configuration (this way, they can choose where to log the SQL). Read the comments to know how to also log the values of the parameters.

Hope I helped.

%d bloggers like this: