August 12, 2015

How to Log SQL Statements, Parameters and Cache in Hibernate?


Current implementation of Hibernate are:

  • Hibernate 4.2 implements JPA 2.0 (EE 6)
  • Hibernate 4.3+ implements JPA 2.1 (EE 7)


Do not set logging level in persistence.xml (hibernate.show_sql, hibernate.format_sql), instead use Log4J for changing logging level.

You can put this in you src/test/resources/ if you want more logging when writing or debugging your test cases.


No comments: