Printing Hibernate generated SQL statements

In logging file (log4j2.xml) enable hibernate loggers:
 
 <Logger name="log4j.logger.org.hibernate.SQL" level="debug" />
 <Logger name="log4j.logger.org.hibernate.type.descriptor.sql" level="trace" />
In persistence.xml turn on printing and formatting SQL statments:
 <property name="hibernate.show_sql" value="true" />
 <property name="hibernate.use_sql_comments" value="true" />
 <property name="hibernate.format_sql" value="true" />

Comments

Popular posts from this blog

Hibernate delete and update queries with joins

Access application Google Drive account from javascript without client side authorization dialog

How to set width of a table within Twitter Bootstrap