OpenJPA and WebSphere JPA configuration properties must be migrated

This rule detects OpenJPA and WebSphere vendor-specific JPA 2.0 configuration properties in the persistence.xml file. You must manually migrate these properties to standardized or EclipseLink properties. The rule flags any property element with a name attribute that starts with openjpa.* or wsjpa.* except for the openjpa.jdbc.Schema property, which is flagged by openjpa.jdbc.Schema rule and openjpa.LockManager property, which is flagged by openjpa.LockManager rule. The wsjpa configuration properties are specific to the WebSphere traditional and Liberty JPA 2.0 implementation built on OpenJPA.

In the following persistence.xml file, all four property elements are flagged by this rule.

<persistence>
  <persistence-unit name="openjpa">
    <properties>
      ...
      <property name="openjpa.ConnectionURL "
                   value="jdbc:db2://host.ibm.com:50000/mydb2user" />
      <property name="openjpa.ConnectionDriverName" value="com.ibm.db2.jcc.DB2Driver" />
      <property name="openjpa.ConnectionUserName" value="mydb2user" />
      <property name="openjpa.ConnectionPassword" value="password" />      
      ...
    </properties>
  </persistence-unit>
</persistence>

To resolve the issue, change the property name to a standardized property when there is one available.

<persistence>
  <persistence-unit name="openjpa">
    <properties>
      ...   
      <property name="javax.persistence.jdbc.url"
                   value="jdbc:db2://host.ibm.com:50000/mydb2user" />
      <property name="javax.persistence.jdbc.driver" value="com.ibm.db2.jcc.DB2Driver" />
      <property name="javax.persistence.jdbc.user" value="mydb2user" />
      <property name="javax.persistence.jdbc.password" value="password" />
      ...
    </properties>
  </persistence-unit>
</persistence>

The second-level cache is enabled in EclipseLink by default. If you have <property name="openjpa.DataCache" value="true"/> set in a a persistence-unit, you can remove this property. For more information, see the Disable the persistence unit second-level cache rule.

For more information on migrating vendor-specific JPA configuration properties, see the following resources: