Wednesday, September 7, 2011

QuickTip: Logging SQL statements in EclipseLink

1279316 question mark

Documentation for EclipseLink is quite lacking.

While for Hibernate it is quite easy to find out how to log SQL statements, I had some trouble to find out how to accomplish this in EclipseLink.

The solution are the following properties in persistence.xml:

 <property name="eclipselink.logging.level.sql" value="FINE"/>
 <property name="eclipselink.logging.parameters" value="true"/>

This solution I finally found here.

An alternative is also to use log4jdbc or log4jdbc-remix (the latter is available in the sonatype maven repository). An example is available in exercise 10 of my jpaworkshop.

1 comment:

Related Posts Plugin for WordPress, Blogger...