Package jakarta.persistence.metamodel
package jakarta.persistence.metamodel
Defines the Jakarta Persistence Metamodel API, allowing runtime
reflection on the managed types declared by a persistence unit.
Instances of metamodel types may be obtained either:
- via programmatic lookup using an instance of
Metamodelobtained by callingEntityManagerFactory.getMetamodel(), or - in a typesafe way, using members of the generated static metamodel classes.
The Metamodel API allows programmatic lookup, but is not
in general typesafe.
SingularAttribute<Book,String> isbnAttribute =
factory.getMetamodel()
.entity(Book.class)
.getId(String.class);
A static metamodel class is a class with static members providing direct type safe access to the metamodel objects representing the persistent members of a given managed class.
SingularAttribute<Book,String> isbnAttribute = Book_.isbn;
- Since:
- 2.0
-
ClassDescriptionAttribute<X,
Y> Represents an attribute of a Java type.BasicType<X>Bindable<T>An instances of the typeBindablerepresents an object or attribute type that can be bound into aPath.Instances of the type BooleanAttribute represents persistent single-valued properties or fields of boolean type.CollectionAttribute<X,E> Instances of the typeCollectionAttributerepresent persistentCollection-valued attributes.ComparableAttribute<X, C extends Comparable<? super C>>Instances of the type ComparableAttribute represents persistent single-valued properties or fields of comparable type.An instance ofEmbeddableTyperepresents an embeddable type.EntityType<X>An instance ofEntityTyperepresents an entity type.An instance of the typeIdentifiableTyperepresents an entity or mapped superclass type.ListAttribute<X,E> Instances of the typeListAttributerepresent persistentList-valued attributes.ManagedType<X>Instances of the typeManagedTyperepresent entity, mapped superclass, and embeddable types.MapAttribute<X,K, V> Instances of the typeMapAttributerepresent persistentMap-valued attributes.An instance of the typeMappedSuperclassTyperepresents a mapped superclass type.Provides access to the metamodel of persistent entities in the persistence unit.Instances of the type NumericAttribute represents persistent single-valued properties or fields of number type.PluralAttribute<X,C, E> Instances of the typePluralAttributerepresent persistent collection-valued attributes.SetAttribute<X,E> Instances of the typeSetAttributerepresent persistentSet-valued attributes.SingularAttribute<X,T> Instances of the typeSingularAttributerepresents persistent single-valued properties or fields.TheStaticMetamodelannotation specifies that the class is a metamodel class that represents the Java type designated by theStaticMetamodel.value()element.Instances of the type TemporalAttribute represents persistent single-valued properties or fields of a temporal type.Instances of the type TextAttribute represents persistent single-valued properties or fields of string type.Type<X>An instance of the typeTyperepresents a persistent object or attribute type.