If you're customizing the Elastic Path core library, you may need to add and/or modify domain classes. The domain classes in your core library extension need to be bytecode-enhanced for persistence through OpenJPA, the same as domain classes in the base core library.
If you're modifying domain class code in the core library directly, you would use ant enhance to enhance these classes. However, since you're using the Binary-based development strategy for the core library, this will not work because you're using Maven to build your core library extension.
To enhance domain classes in your core library extension, you need to do the following:
- Download the Elastic Path OpenJPA Maven plugin.

License
This plugin extends the OpenJPA Maven plugin and is released under the Apache 2 license. - Install it in your repository.
mvn install:install-file -DgroupId=org.codehaus.mojo -DartifactId=ep-openjpa-maven-plugin ^ -Dversion=1.0.0-SNAPSHOT -Dpackaging=jar -Dfile=ep-openjpa-maven-plugin-1.0.0-SNAPSHOT.jar ^ -DgeneratePom=true

The DOS line continuation character (^) is used for readability. To copy and paste the previous command on Linux, use \ instead of ^. - Edit the extension's persistence-renamed.xml and add the openjpa.DetachState as follows:

This property is required to ensure attached state is maintained across serialization boundaries. If not set, some objects may contain null fields after serialization. - Edit the pom.xml in your core library extension project directory and add the following plugin:

Make sure you specify the correct OpenJPA version number in the dependencies section.
The enhancer will be invoked automatically during the process-classes phase of the build.
Labels:
None