3.8.10.2. Custom Discriminator and Version Strategies

To define a custom discriminator or version strategy, implement the org.apache.openjpa.jdbc.meta.DiscriminatorStrategy or org.apache.openjpa.jdbc.meta.VersionStrategy interface, respectively. You might extend one of the existing abstract or concrete strategies in the org.apache.openjpa.jdbc.meta.strats package.

OpenJPA includes the org.apache.openjpa.persistence.jdbc.DiscriminatorStrategy and org.apache.openjpa.persistence.jdbc.VersionStrategy class annotations for declaring a custom discriminator or version strategy in JPA mapping metadata. Set the string value of these annotations to the full class name of your implementation, or to the class name or alias of an existing OpenJPA implementation.

As with custom class mappings, you can configure your strategy class' bean properties using OpenJPA’s plugin syntax, detailed in Plugin Configuration.