Do not use OpenJPA providers in the persistence.xml file

When you migrate to EclipseLink, do not use OpenJPA providers in the persistence.xml file. Using OpenJPA providers in EclipseLink results in runtime errors. To resolve these errors, either use the automated fix to remove the flagged OpenJPA provider from the persistence.xml file or replace the OpenJPA provider with the appropriate EclipseLink provider.

For example, the rule flags the following OpenJPA provider in a persistence.xml file.

<persistence-unit name="JPAService" >
	<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
	<jta-data-source>java:comp/env/jdbc/DB2Connection</jta-data-source>
	<class>my.jpa.Account</class>
</persistence-unit>

The following example shows how the automated fix modifies the persistence.xml file.

<persistence-unit name="JPAService" >
	
	<jta-data-source>java:comp/env/jdbc/DB2Connection</jta-data-source>
	<class>my.jpa.Account</class>
</persistence-unit>

Alternatively, you can manually fix this issue by specifying the EclipseLink provider as shown in the following example:

<persistence-unit name="JPAService" >
	<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
	<jta-data-source>java:comp/env/jdbc/DB2Connection</jta-data-source>
	<class>my.jpa.Account</class>
</persistence-unit>

Copy the custom configuration to your application build file to enable the fix automation.

For information about this OpenJPA to EclipseLink migration issue, see the Migration from OpenJPA to EclipseLink: Persistence XML guide.