Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] SQL Statement for JPA query

Alexander,
    A couple more points.
    If you happen to be running on WebLogic - you need to enable the logger via
      <!-- new for 10.3.4.0 http://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging#Server_Logging  -->
      <property name="eclipselink.logging.logger" value="DefaultLogger"/>     

    Also, if you need to see parameter values for debugging, then also set this flag to true
      <!-- enable SQL parameter binding visibility logging to override ER 329852 -->
      <property name="eclipselink.logging.parameters" value="true"/>

    thank you
    Michael O'Brien
    http://www.eclipselink.org


On 23/03/2011 05:37, Rohit Banga wrote:
Yes it is possible to do that.

If you just want to see the SQL that was executed, set logging level to FINEST.

If you want it as a string object then use the following function calls:

        ObjectLevelReadQuery query;
        ...
        query.prepareCall(session, new DatabaseRecord());
        query.getSQLString();

Hope that helps!

On 3/23/2011 2:51 PM, Neubauer, Alexander wrote:
Hi,

is it possible to get the SQL statement for a JPA query as string before
execution?

Thanks for your help.


CENIT AG, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711 7825-30, Fax: +49 711 7825-4000, Internet: www.cenit.de
Geschaeftsstellen: Berlin, Duesseldorf, Frankfurt, Hamburg, Hannover, Muenchen, Neu-Isenburg, Oelsnitz, Ratingen, Saarbruecken
Vorstandsmitglieder: Kurt Bengel, Christian Pusch
Aufsichtsratsmitglieder: Andreas Schmidt (Vorsitzender des Aufsichtsrats), Hubert Leypoldt, Andreas Karrer
Bankverbindungen:
Deutsche Bank (BLZ 600 700 70) Kto. 1661 040 IBAN : DE85 6007 0070 0166 1040 00 SWIFT-CODE : DEUTDESS,
Commerzbank (BLZ 600 400 71) Kto. 532 015 500 IBAN : DE83 6004 0071 0532 0155 00 SWIFT-Code : COBADEFF600,
BW-Bank (BLZ 600 501 01) Kto. 2 403 313 IBAN : DE17 6005 0101 0002 4033 13 SWIFT-Code : SOLADEST
Registergericht: Amtsgericht Stuttgart
Handelsregister: HRB Nr. 19117
Umsatzsteuer: ID-Nr. DE 147 862 777

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
    

--
Thanks and Regards
Rohit Banga
Member Technical Staff
Oracle Server Technologies

_______________________________________________ eclipselink-users mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users

Back to the top