Thiagz
Thiagz

Reputation: 131

Is there a way to get query being fired in eclipselink

I have a requirement where I need to grab the Insert and Update Native SQL statement being fired and store it in a log table in the DB. Is it possible for me to get the query in eclipselink?

Upvotes: 0

Views: 325

Answers (1)

ewramner
ewramner

Reputation: 6233

Register your own custom logger that logs to your database rather than to the file system and configure eclipselink.logging.level.sql=FINE in the persistence unit. Then you can piggy-back on the existing solution for logging SQL statements and save them to the log table. See http://wiki.eclipse.org/EclipseLink/Examples/JPA/CustomLogger and https://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging for details.

Upvotes: 1

Related Questions