OpenJPA Logo   ASF Logo

Fetch Statistics

The OpenJPA Fetch Statistics Tool (FST) monitors persistent field access and helps determine which fields in an application are not used. This tool is a development / test time tool that can help a developer properly tune an application.


  • Currently, FST only works with runtime enhancement (javaagent or in JEE container hook).

  • The persistent fields which satisfy all the following conditions will be tracked :

    • The field is fetched eagerly.
    • The field is not a primary key.
    • The field is not defined as a version field.


The latest OpenJPA FST jar file can be download from the SNAPSHOT Repository or can be built from the source code in [svn|] by using Maven 2.2.1 and Java SE 6.


  • JSE - Append the path of openjpa-fetch-statistics-version-SNAPSHOT.jar file to the classpath prior to lanuching the JVM.
  • Websphere Application Server
  • OSGi -- ?? -- Probably need another module that creates a proper bundle.

Statistics Collecting and Monitoring

There will be a large performance impact when running this tooling. It is not supported, nor recommended for production use. This tool should not be used on a production machine.

  • When this tool is configured, it will be active for all persistence units in the JVM. Statistics will be dumped via the openjpa.Runtime channel with the INFO level every 10 minutes, or when the JVM terminates.

Example output

    [7/13/12 9:05:44:265 CDT](7/13/12-9:05:44:265-cdt.html)
     00000072 Runtime   I   CWWJP9990I: openjpa.Runtime: Info: Successfully collected fetch statistics from Entities [org.apache.openjpa.test.Address]. The following fields are
    FetchType.EAGER and were never fetched [ total 7 ] :

Configuration removal

  • Stop the JVM and reverse the steps completed to configure the tool.
Copyright © 2006,2020 The Apache Software Foundation. Licensed under Apache License 2.0.
Apache, the Apache feather logo and OpenJPA are trademarks of The Apache Software Foundation.
Other names may be trademarks of their respective owners.