Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Logging each actual *real* SQL query

Thank you, I will look into that.

On Fri, Sep 10, 2010 at 6:30 PM, Frank Schwarz <fs5@xxxxxxx> wrote:

It looks like that there is no simple solution for getting the 'real' SQL
statements. Even the EL testsuite only captures the SQL-logging (see
org.eclipse.persistence.testing.framework.QuerySQLTracker,
https://fisheye2.atlassian.com/browse/eclipselink/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/framework/QuerySQLTracker.java?r=HEAD).

You could adopt the QuerySQLTracker for your purposes and additionally file
an enhancement request for EclipseLink to print out strings with quotes
('abc') and long-values with its suffix (123L) in the "bind"-messages.

-- Frank


Torbjorn Kristoffersen wrote:
>
> How would one go about retrieving each SQL query that the JPA (in this
> case,
> EclipseLink 2) layer performs on the database?
>
> I am interested in absolutely all the SQL queries.  I tried intercepting
> them using postUpdate, postInsert and so on, but seeing I use parameter
> binding I can't get the actual native SQL query, illustrated by the the
> FINE
> logging as seen in my Glassfish log:
>
> SELECT x,y,z FROM footable WHERE My_ID = ? LIMIT ? OFFSET ?
>         bind => [274087, 15, 0]|#]
>
> I need to find out the exact query that is run on the actual SQL server.
> In
> the case above, I can't be certain whether 274087 is an int, or a string.
>  If it is a string, then I it would have to be enclosed in quotes.
>
> So what I'm looking for is the following result:
>
> SELECT x,y,z FROM footable WHERE My_ID = '274087' LIMIT 15 OFFSET 0
>
> Hope someone can help... Thanks!
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
>

--
View this message in context: http://old.nabble.com/Logging-each-actual-*real*-SQL-query-tp29672210p29678715.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.

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


Back to the top