Enable SQL printing in Hibernate
To enable SQL output for Hibernate you have two steps:
1. show_sql
Enable the logging of all the generated SQL statements to the console
<!--hibernate.cfg.xml -->
<property name="show_sql">true</property>
2. format_sql
Format the generated SQL statement to make it more readable, but takes up more screen space. :)
<!--hibernate.cfg.xml -->
<property name="format_sql">true</property>
And last optional but nice to have step:
3. usesqlcomments
Hibernate will put comments inside all generated SQL statements to hint what’s the generated SQL trying to do
<!--hibernate.cfg.xml -->
<property name="use_sql_comments">true</property>
Written by Alexander Rashkov
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Sql
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#