Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added dynamic enhancement section.

...

Additional information regarding the subclassing enhancement can be found in the OpenJPA docs.

Dynamic Enhancement

OPENJPA-952 added the capability to have OpenJPA attempt to dynamically load the javaagent enhancer. If you see the following message, OpenJPA loaded the enhancer dynamically.

Wiki Markup
\[java\] 1453  jpa_app  INFO   \[main\] openjpa.Runtime - OpenJPA dynamically loaded the class enhancer. Any classes that were not enhanced at build time will be enhanced when the are loaded by the JVM.

This method of enhancement is intended for first time users or developers as it has a number of caveats.

  • It only works on Sun 1.6SDK, not the JRE.
  • If any unenhanced Entities are loaded by the JVM before an EntityManagerFactory is created, this method of enhancement will not work. If this condition is encountered, you will see the following warning:

    Wiki Markup
    \[java\] 1047  jpa_app  WARN   \[main\] openjpa.Enhance - Unenhanced classes were detected even though the enhancer has ran. Ensure that the EntityManagerFactory is created prior to creating any Entities.

If your application uses some other method of enhancement, this support can be disabled by setting the following property in your persistence.xml.

<property name="openjpa.DynamicEnhancementAgent" value="false"/>

Author Attribution

The content for this page and sub-pages was adapted from content created by OpenJPA contributor Rick Curtis from the following WebSphere and Java Persistence blog entries:
http://webspherepersistence.blogspot.com/2009/02/openjpa-enhancement.html
http://webspherepersistence.blogspot.com/2009/04/openjpa-enhancement-eclipse-builder.html