The metamodel module extends the metamodel built up by Naked Objects to include JPA semantics.

This is done for two reasons:

  • to provide an alternative mechanism for specifying semantics that Naked Objects already recognizes

    An example of this is the optionality of a property, which can be derived from the JPA @Basic annotation instead of Naked Objects' @Optional annotation

  • to add in additional semantics for use by JPA Objects' runtime module

    An example of this is the JPA @Id annotation that is used by JPA Objects to build internal object identifiers (OIDs).

The metamodel module provides implementations of several of Naked Objects' APIs, including:

  • FacetFactorys capture the JPA semantics into the metamodel.
  • a MetaModelValidator enforces a number of rules.

    For example, JPA Objects checks that a domain object annotated as @Entity is not also annotated as @Embedded

When using JPA Objects we configure Naked Objects to use this extended metamodel using the property:

+----------------------------------------------------------------------------------------+ nakedobjects.reflector=org.starobjects.jpa.metamodel.specloader.JpaJavaReflectorInstaller +----------------------------------------------------------------------------------------+

This is typically done by adding the property in file. See the user guide for more details.