1

我开发JPA Toplink了使用 JPQL 的应用程序。根据我的研究,JPA 将调用比 JPQL 语句看起来更多的 SQL。

我正在寻找一些 JPQL 分析器工具,例如我可以执行 JPQL 或运行我的应用程序并告诉我正在运行多少实际 SQL。

有没有类似的东西?

更新 按照建议在我的persistence.xml中添加了以下内容,我的Netbean IDE现在显示JPQL生成的实际SQL:D

  <properties>
      <property name="eclipselink.logging.logger" value="JavaLogger"/>
      <property name="toplink.logging.level.sql" value="FINE"/>
4

1 回答 1

5

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

于 2010-12-27T07:26:55.793 回答