Question

I developed app using JPA Toplink which uses JPQL. According to my research JPA will call more SQL than what JPQL statement look like.

I'm looking for some JPQL analyzer tools like I can execute JPQL or run my application and tells me how many actual SQL being run.

Is there anything like that available?

UPDATE Added the following in my persistence.xml as suggested and my Netbean IDE now shows actual SQL generated by JPQL :D

  <properties>
      <property name="eclipselink.logging.logger" value="JavaLogger"/>
      <property name="toplink.logging.level.sql" value="FINE"/>
Was it helpful?

Solution

I don't think there can be a generic analyzer as the behavior is provider specific. You can however look at the SQL's being executed by enabling appropriate logs of the JPA provider you are using.

Hibernate:

Can't make hibernate stop showing SQL using Spring JPA Vendor Adapter

EclipseLink:

http://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging

http://www.adam-bien.com/roller/abien/entry/glassfish_and_jpa_sql_monitoring

OpenJPA:

http://openjpa.apache.org/faq.html#FAQ-HowdoIseetheSQLthatOpenJPAisexecuting%253F

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top