Logging JPA SQL Statements in TomEE

If you are coding using JPA, monitoring the generated SQL statements is absolutely necessary. To enable logging of the SQL statements, add these lines in boldface to your persistence.xml for a persistence unit.

<persistence-unit name="VikingoWeb">
        <property name="openjpa.Log" value="SQL=TRACE" />
        <property name="openjpa.ConnectionFactoryProperties" 

The second property will log the parameter values that are injected into a prepared statement.


2 thoughts on “Logging JPA SQL Statements in TomEE

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s