Use OpenJPA property values instead of Kodo-specific property values

WebLogic used Kodo instead of OpenJPA for its JPA 1.0 provider implementation. This rule converts kodo-specific property values to OpenJPA. This rule detects kodo-specific property values in a Java file. The property name and the property value must be String literal parameters to a put method. The property name must be the first parameter, the key, and the property value must be the second parameter. This rule only converts the property values. A separate rule converts the property name if necessary.

For example, the following code is flagged:
map.put("kodo.Log", "Remote=TRACE, SQL=TRACE");

map.put("kodo.Log", "SQL=TRACE");
The automated fix will remove the value, Remote=TRACE, because it is not a valid OpenJPA value.

The following table shows the values that can be converted:
Class Description
kodo.Log
  • Removes the values Configuration, Remote, Manage and Profile
  • Converts kodo.* to openjpa.*
kodo.ConnectionFactoryProperties
  • Valid values are QueryTimeout, PrettyPrint, PrettyPrintLineLength.
  • Removes all other values
kodo.ConnectionFactory2Properties
  • Valid values are QueryTimeout, PrettyPrint, PrettyPrintLineLength.
  • Removes all other values
kodo.MetaDataFactory
  • Valid values are jpa or org.apache.openjpa.persistence.PersistenceMetaDataFactory.
  • Removes all other values and set the value to jpa
kodo.LockManager
  • Converts kodo.* to org.apache.openjpa.*
  • Aliases remain the same.
kodo.OrphanedKeyAction
  • Converts kodo.* to org.apache.openjpa.*
  • Aliases remain the same.
kodo.SavepointManager
  • Converts kodo.* to org.apache.openjpa.*
  • Aliases remain the same.
kodo.Sequence
  • Converts kodo.* to org.apache.openjpa.*
  • Aliases remain the same.
kodo.DataCache
  • Selects only the first cache entry. All other entries are discarded.
  • If the first entry is set to tangosol, lru, or gemfire, then the value is set to 'true'.
  • If the first entry has values, they are preserved. For example true(CacheSize=100).
  • If the first entry is false, it remains false.
kodo.QueryCompilationCache
  • The value, kodo.util.CacheMap, is converted to org.apache.openjpa.util.CacheMap.
  • The value, java.util.HashMap, is converted to org.apache.openjpa.lib.util.ConcurrentHash.
  • Aliases remain the same.
kodo.jdbc.DBDictionary
  • Converts kodo.* to: org.apache.openjpa.*
  • Aliases remain the same.
kodo.jdbc.SchemaFactory
  • Converts kodo.* to: org.apache.openjpa.*
  • Aliases remain the same.
kodo.jdbc.MappingDefaults
  • Valid value is default.
kodo.ee.ManagedRuntime
  • Converts kodo.* to: org.apache.openjpa.*
  • Aliases remain the same.

Note: WebSphere traditional V8.5.5 and Liberty Web Profile 6.0 uses OpenJPA for its JPA 2.0 implementation. WebSphere traditional V9.0 and Liberty's Java EE 7 JPA 2.1 implementation uses EclipseLink.