Enhancement of JPA entities for JPA 2.0

The JPA 2.0 provider that is included in Liberty is based on Apache OpenJPA. OpenJPA uses Java™ bytecode enhancement of JPA persistent types (Entity, Embeddable, MappedSuperclass) to add state tracking, and other necessary information to enable persistence and other optimized features within JPA classes. In an application server environment, enhancement of your JPA entities occurs automatically when the application is loaded by Liberty server.

Pre-enhancement of JPA classes (or build time enhancement) is necessary when a persistence JAR is used in both application server, and non-application server environments. The most common ways to perform build time enhancement are the OpenJPA enhancer Ant task, and PCEnhancer. These build time enhancement options require the OpenJPA library and dependent libraries to be on the classpath. The wsenhancer command, in the WebSphere Application Server traditional install, can also be used.
Note: The JPA 2.1 specification provider for Liberty is EclipseLink. EclipseLink does not require entity enhancement.