JPA Metamodel Attributes

The Jakarta Persistence (JPA) Metamodel API defines a structured hierarchy of interfaces and enumerations to represent the attributes of managed persistent types (entities, embeddable and superclasses).

Metamodel Attributes Hierarchy in Jakarta Persistence (JPA) 3.

Base attribute definitions

The core abstractions of model attributes are the following components:

The top-level interface of the attributes hierarchy, representing any persistent attribute known to the persistence provider.

An enumeration defining the categorization of the attribute: BASIC, EMBEDDED, MANY_TO_ONE, ONE_TO_MANY, ONE_TO_ONE, or MANY_TO_MANY.

Singular attributes

Single-valued attributes are represented by:

Represents single-valued attributes. This includes basic types (primitives, wrappers, Strings), embedded objects, and associations (reference fields and properties) with "To-One" cardinality.

Plural (collection) attributes

Collection-valued attributes are represented by the following hierarchy:

The base interface for all collection-valued attributes, defining the element type stored within the collection.

An enumeration defining the specific type of collection interface used: COLLECTION, SET, LIST, or MAP.

Represents an attribute typed as a generic java.util.Collection.

Represents an attribute typed as a java.util.Set, implying unique elements without a specific order.

Represents an attribute typed as a java.util.List, supporting ordered collections and index-based access.

Represents an attribute typed as a java.util.Map, managing both keys and values.

For more information on the hierarchy and usage examples, see the Metamodel Attribute Interface Hierarchy section.