MetaModel Attributes for Arrays

In previous releases OpenJPA’s MetaModel implementation generated a ListAttribute for every array. This behavior is correct if the array is annotated as a PersistentCollection, but not correct for un-annotated arrays (e.g. byte[], char[]). In OpenJPA 2.2.0 this behavior was corrected so that arrays which are not stored as PersistentCollections will use a SingularAttribute instead of a ListAttribute.

If your application uses the MetaModel API and your entities contain arrays of any of the following types: byte[], Byte[], char[], Character[] and do not use the @PersistentCollection annotation with those fields you will need to update your application to use OpenJPA 2.2.0.

In order for the existing applications to work with OpenJPA you may:

  • Regenerate the canonical metamodel classes

  • Set the Compatibility property UseListAttributeForArrays to true in persistence.xml

 <property name="openjpa.Compatibility" value="UseListAttributeForArrays=true"/>