How to view the SQL queries issued by JPA?

Logging options are provider-specific. You need to know which JPA implementation do you use.

  • Hibernate (see here):

    <property name = "hibernate.show_sql" value = "true" />
    
  • EclipseLink (see here):

    <property name="eclipselink.logging.level" value="FINE"/>
    
  • OpenJPA (see here):

    <property name="openjpa.Log" value="DefaultLevel=WARN,Runtime=INFO,Tool=INFO,SQL=TRACE"/>
    
  • DataNucleus (see here):

    Set the log category DataNucleus.Datastore.Native to a level, like DEBUG.

Leave a Comment