Top Description Fields Constructors Methods
org.hibernate.metamodel.internal

public Class MetadataContext

extends Object
Class Inheritance
Annotations
@Internal
Imports
java.lang.reflect.Field, java.util.ArrayList, .Collections, .HashMap, .HashSet, .List, .Map, .Set, java.util.function.BiFunction, org.hibernate.AssertionFailure, .Internal, .MappingException, org.hibernate.boot.spi.MetadataImplementor, org.hibernate.internal.EntityManagerMessageLogger, .HEMLogging, org.hibernate.internal.util.ReflectHelper, org.hibernate.internal.util.collections.CollectionHelper, org.hibernate.mapping.Component, .MappedSuperclass, .PersistentClass, .Property, org.hibernate.metamodel.MappingMetamodel, org.hibernate.metamodel.model.domain.AbstractIdentifiableType, .BasicDomainType, .EmbeddableDomainType, .EntityDomainType, .IdentifiableDomainType, .ManagedDomainType, .MappedSuperclassDomainType, .PersistentAttribute, .SingularPersistentAttribute, org.hibernate.metamodel.model.domain.internal.AttributeContainer, .BasicTypeImpl, .EmbeddableTypeImpl, .EntityTypeImpl, .MappedSuperclassTypeImpl, .MappingMetamodelImpl, .PrimitiveBasicTypeImpl, org.hibernate.metamodel.model.domain.spi.JpaMetamodelImplementor, org.hibernate.metamodel.spi.RuntimeModelCreationContext, org.hibernate.type.descriptor.java.JavaType, org.hibernate.type.descriptor.java.spi.EntityJavaType, .JavaTypeRegistry, org.hibernate.type.descriptor.jdbc.JdbcType, org.hibernate.type.spi.TypeConfiguration, jakarta.persistence.metamodel.Attribute, .IdentifiableType, .SingularAttribute, .Type

Defines a context for storing information during the building of the MappingMetamodelImpl.

This contextual information includes data needing to be processed in a second pass as well as cross-references into the built metamodel classes.

At the end of the day, clients are interested in the getEntityTypeMap and getEmbeddableTypeSet results, which represent all the registered entities and embeddables respectively.

Authors
Steve Ebersole, Emmanuel Bernard

Field Summary

Modifier and TypeField and Description
private final AttributeFactory
private final Map<Class<?>, BasicDomainType<?>>
private final Map<EmbeddableDomainType<?>, Component>
private final Map<Class<?>, EmbeddableDomainType<?>>
private final Map<Class<?>, List<EmbeddableDomainType<?>>>
private final Map<Class<?>, EntityDomainType<?>>
private final Map<PersistentClass, EntityDomainType<?>>
private final Map<String, IdentifiableDomainType<?>>
private final JpaMetamodelImplementor
private final JpaMetaModelPopulationSetting
private final JpaStaticMetaModelPopulationSetting
private final Set<MappedSuperclass>
private static final EntityManagerMessageLogger
private final Map<MappedSuperclass, MappedSuperclassDomainType<?>>
private final Map<MappedSuperclassDomainType<?>, PersistentClass>
private final MappingMetamodel
private final List<Object>
private final Set<Class<?>>
private final RuntimeModelCreationContext
runtimeModelCreationContext

Deprecated as a consequence of RuntimeModelCreationContext being deprecated.
private final List<PersistentClass>
stackOfPersistentClassesBeingProcessed

Stack of PersistentClass being processed.

private final TypeConfiguration

Constructor Summary

AccessConstructor and Description
public
MetadataContext(JpaMetamodelImplementor jpaMetamodel, MappingMetamodel mappingMetamodel, MetadataImplementor bootMetamodel, JpaStaticMetaModelPopulationSetting jpaStaticMetaModelPopulationSetting, JpaMetaModelPopulationSetting jpaMetaModelPopulationSetting, RuntimeModelCreationContext runtimeModelCreationContext)

Deprecated as a consequence of MetadataImplementor and RuntimeModelCreationContext being deprecated.

Method Summary

Modifier and TypeMethod and Description
private void
private <X> void
private EmbeddableTypeImpl<?>
applyIdClassMetadata(Component idClassComponent)

private void
applyIdMetadata(PersistentClass persistentClass, IdentifiableDomainType<?> identifiableType)

private <X> void
private <X> void
applyVersionAttribute(PersistentClass persistentClass, EntityDomainType<X> jpaEntityType)

private <X> void
private <X> PersistentAttribute<X, ?>
private <X> Set<SingularPersistentAttribute<? super X, ?>>
public Component
public Set<EmbeddableDomainType<?>>
public Map<Class<?>, EntityDomainType<?>>

Returns:

The java type to EntityTypeImpl map.
getEntityTypeMap
()

Retrieves the java type to EntityTypeImpl map.

private PersistentClass
public Map<String, IdentifiableDomainType<?>>
public JavaTypeRegistry
public JpaMetamodelImplementor
private MappedSuperclass
private MappedSuperclass
private Property
public Map<Class<?>, MappedSuperclassDomainType<?>>
pack-priv MappingMetamodel
public PersistentClass
public RuntimeModelCreationContext
getRuntimeModelCreationContext()

Deprecated as a consequence of RuntimeModelCreationContext being deprecated.
public TypeConfiguration
public Set<MappedSuperclass>
private static <X> void
injectField(Class<?> metamodelClass, String name, Object model, boolean allowNonDeclaredFieldReference)

public <J> EmbeddableDomainType<J>
locateEmbeddable(Class<J> embeddableClass, Component component)

public EntityDomainType<?>

Returns:

Tne corresponding JPA org.hibernate.type.EntityType, or null if not yet processed.
locateEntityType
(PersistentClass
The Hibernate (config time) metamodel instance representing an entity.
persistentClass
)

Given a Hibernate PersistentClass, locate the corresponding JPA org.hibernate.type.EntityType implementation.

public EntityDomainType<?>

Returns:

The corresponding JPA org.hibernate.type.EntityType, or null.
locateEntityType
(Class<?>
The java class.
javaType
)

Given a Java Class, locate the corresponding JPA org.hibernate.type.EntityType.

public <E> IdentifiableDomainType<E>

Returns:

The corresponding JPA org.hibernate.type.EntityType, or null.
locateIdentifiableType
(String
The entity-name.
entityName
)

Given an entity-name, locate the corresponding JPA org.hibernate.type.EntityType.

public MappedSuperclassDomainType<?>
public void
private <X> void
public void
private <X> void
registerAttribute(Class<?> metamodelClass, Attribute<X, ?> attribute)

private <X> void
registerAttributes(Class<?> metamodelClass, ManagedDomainType<X> managedType)

public void
public void
registerEmbeddableType(EmbeddableDomainType<?> embeddableType, Component bootDescriptor)

public void
registerEntityType(PersistentClass persistentClass, EntityTypeImpl<?> entityType)

public void
public <J> BasicDomainType<J>
resolveBasicType(Class<J> javaType)

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeFactoryback to summary
private final AttributeFactory attributeFactory
basicDomainTypeMapback to summary
private final Map<Class<?>, BasicDomainType<?>> basicDomainTypeMap
componentByEmbeddableback to summary
private final Map<EmbeddableDomainType<?>, Component> componentByEmbeddable
embeddablesback to summary
private final Map<Class<?>, EmbeddableDomainType<?>> embeddables
embeddablesToProcessback to summary
private final Map<Class<?>, List<EmbeddableDomainType<?>>> embeddablesToProcess
entityTypesback to summary
private final Map<Class<?>, EntityDomainType<?>> entityTypes
entityTypesByPersistentClassback to summary
private final Map<PersistentClass, EntityDomainType<?>> entityTypesByPersistentClass
identifiableTypesByNameback to summary
private final Map<String, IdentifiableDomainType<?>> identifiableTypesByName
jpaMetamodelback to summary
private final JpaMetamodelImplementor jpaMetamodel
jpaMetaModelPopulationSettingback to summary
private final JpaMetaModelPopulationSetting jpaMetaModelPopulationSetting
jpaStaticMetaModelPopulationSettingback to summary
private final JpaStaticMetaModelPopulationSetting jpaStaticMetaModelPopulationSetting
knownMappedSuperclassesback to summary
private final Set<MappedSuperclass> knownMappedSuperclasses
LOGback to summary
private static final EntityManagerMessageLogger LOG
mappedSuperclassByMappedSuperclassMappingback to summary
private final Map<MappedSuperclass, MappedSuperclassDomainType<?>> mappedSuperclassByMappedSuperclassMapping
mappedSuperClassTypeToPersistentClassback to summary
private final Map<MappedSuperclassDomainType<?>, PersistentClass> mappedSuperClassTypeToPersistentClass
metamodelback to summary
private final MappingMetamodel metamodel
orderedMappingsback to summary
private final List<Object> orderedMappings
processedMetamodelClassesback to summary
private final Set<Class<?>> processedMetamodelClasses
runtimeModelCreationContextback to summary
private final RuntimeModelCreationContext runtimeModelCreationContext

Deprecated

as a consequence of RuntimeModelCreationContext being deprecated. See corresponding docs for further information.

stackOfPersistentClassesBeingProcessedback to summary
private final List<PersistentClass> stackOfPersistentClassesBeingProcessed

Stack of PersistentClass being processed. Last in the list is the highest in the stack.

typeConfigurationback to summary
private final TypeConfiguration typeConfiguration

Constructor Detail

MetadataContextback to summary
public MetadataContext(JpaMetamodelImplementor jpaMetamodel, MappingMetamodel mappingMetamodel, MetadataImplementor bootMetamodel, JpaStaticMetaModelPopulationSetting jpaStaticMetaModelPopulationSetting, JpaMetaModelPopulationSetting jpaMetaModelPopulationSetting, RuntimeModelCreationContext runtimeModelCreationContext)

Deprecated

as a consequence of MetadataImplementor and RuntimeModelCreationContext being deprecated. See corresponding docs for further information.

Method Detail

addAttributeback to summary
private void addAttribute(ManagedDomainType<?> type, PersistentAttribute<Object, ?> attribute)
applyGenericPropertiesback to summary
private <X> void applyGenericProperties(PersistentClass persistentClass, EntityDomainType<X> entityType)
applyIdClassMetadataback to summary
private EmbeddableTypeImpl<?> applyIdClassMetadata(Component idClassComponent)
applyIdMetadataback to summary
private void applyIdMetadata(PersistentClass persistentClass, IdentifiableDomainType<?> identifiableType)
applyIdMetadataback to summary
private <X> void applyIdMetadata(MappedSuperclass mappingType, MappedSuperclassDomainType<X> jpaMappingType)
applyVersionAttributeback to summary
private <X> void applyVersionAttribute(PersistentClass persistentClass, EntityDomainType<X> jpaEntityType)
applyVersionAttributeback to summary
private <X> void applyVersionAttribute(MappedSuperclass mappingType, MappedSuperclassDomainType<X> jpaMappingType)
buildAttributeback to summary
private <X> PersistentAttribute<X, ?> buildAttribute(Property property, IdentifiableDomainType<X> entityType, BiFunction<IdentifiableDomainType<X>, Property, PersistentAttribute<X, ?>> factoryFunction)
buildIdClassAttributesback to summary
private <X> Set<SingularPersistentAttribute<? super X, ?>> buildIdClassAttributes(IdentifiableDomainType<X> ownerType, List<Property> properties)
getEmbeddableBootDescriptorback to summary
public Component getEmbeddableBootDescriptor(EmbeddableDomainType<?> embeddableType)
getEmbeddableTypeSetback to summary
public Set<EmbeddableDomainType<?>> getEmbeddableTypeSet()
getEntityTypeMapback to summary
public Map<Class<?>, EntityDomainType<?>> getEntityTypeMap()

Retrieves the java type to EntityTypeImpl map.

Returns:Map<Class<?>, EntityDomainType<?>>

The java type to EntityTypeImpl map.

getEntityWorkedOnback to summary
private PersistentClass getEntityWorkedOn()
getIdentifiableTypesByNameback to summary
public Map<String, IdentifiableDomainType<?>> getIdentifiableTypesByName()
getJavaTypeRegistryback to summary
public JavaTypeRegistry getJavaTypeRegistry()
getJpaMetamodelback to summary
public JpaMetamodelImplementor getJpaMetamodel()
getMappedSuperclassback to summary
private MappedSuperclass getMappedSuperclass(PersistentClass persistentClass)
getMappedSuperclassback to summary
private MappedSuperclass getMappedSuperclass(MappedSuperclass mappedSuperclass)
getMappedSuperclassIdentifierback to summary
private Property getMappedSuperclassIdentifier(PersistentClass persistentClass)
getMappedSuperclassTypeMapback to summary
public Map<Class<?>, MappedSuperclassDomainType<?>> getMappedSuperclassTypeMap()
getMetamodelback to summary
pack-priv MappingMetamodel getMetamodel()
getPersistentClassHostingPropertiesback to summary
public PersistentClass getPersistentClassHostingProperties(MappedSuperclassTypeImpl<?> mappedSuperclassType)
getRuntimeModelCreationContextback to summary
public RuntimeModelCreationContext getRuntimeModelCreationContext()

Deprecated

as a consequence of RuntimeModelCreationContext being deprecated. See corresponding docs for further information.

getTypeConfigurationback to summary
public TypeConfiguration getTypeConfiguration()
getUnusedMappedSuperclassesback to summary
public Set<MappedSuperclass> getUnusedMappedSuperclasses()
injectFieldback to summary
private static <X> void injectField(Class<?> metamodelClass, String name, Object model, boolean allowNonDeclaredFieldReference) throws NoSuchFieldException
locateEmbeddableback to summary
public <J> EmbeddableDomainType<J> locateEmbeddable(Class<J> embeddableClass, Component component)
locateEntityTypeback to summary
public EntityDomainType<?> locateEntityType(PersistentClass persistentClass)

Given a Hibernate PersistentClass, locate the corresponding JPA org.hibernate.type.EntityType implementation. May return null if the given PersistentClass has not yet been processed.

Parameters
persistentClass:PersistentClass

The Hibernate (config time) metamodel instance representing an entity.

Returns:EntityDomainType<?>

Tne corresponding JPA org.hibernate.type.EntityType, or null if not yet processed.

locateEntityTypeback to summary
public EntityDomainType<?> locateEntityType(Class<?> javaType)

Given a Java Class, locate the corresponding JPA org.hibernate.type.EntityType. May return null which could mean that no such mapping exists at least at this time.

Parameters
javaType:Class<?>

The java class.

Returns:EntityDomainType<?>

The corresponding JPA org.hibernate.type.EntityType, or null.

locateIdentifiableTypeback to summary
public <E> IdentifiableDomainType<E> locateIdentifiableType(String entityName)

Given an entity-name, locate the corresponding JPA org.hibernate.type.EntityType. May return null which could means that no such mapping exists at least at this time.

Parameters
entityName:String

The entity-name.

Returns:IdentifiableDomainType<E>

The corresponding JPA org.hibernate.type.EntityType, or null.

Annotations
@SuppressWarnings:unchecked
locateMappedSuperclassTypeback to summary
public MappedSuperclassDomainType<?> locateMappedSuperclassType(MappedSuperclass mappedSuperclass)
popEntityWorkedOnback to summary
public void popEntityWorkedOn(PersistentClass persistentClass)
populateStaticMetamodelback to summary
private <X> void populateStaticMetamodel(ManagedDomainType<X> managedType)
pushEntityWorkedOnback to summary
public void pushEntityWorkedOn(PersistentClass persistentClass)
registerAttributeback to summary
private <X> void registerAttribute(Class<?> metamodelClass, Attribute<X, ?> attribute)
registerAttributesback to summary
private <X> void registerAttributes(Class<?> metamodelClass, ManagedDomainType<X> managedType)
registerComponentByEmbeddableback to summary
public void registerComponentByEmbeddable(EmbeddableDomainType<?> embeddableType, Component bootDescriptor)
registerEmbeddableTypeback to summary
public void registerEmbeddableType(EmbeddableDomainType<?> embeddableType, Component bootDescriptor)
registerEntityTypeback to summary
public void registerEntityType(PersistentClass persistentClass, EntityTypeImpl<?> entityType)
registerMappedSuperclassTypeback to summary
public void registerMappedSuperclassType(MappedSuperclass mappedSuperclass, MappedSuperclassDomainType<?> mappedSuperclassType)
resolveBasicTypeback to summary
public <J> BasicDomainType<J> resolveBasicType(Class<J> javaType)
wrapUpback to summary
public void wrapUp()
Annotations
@SuppressWarnings:unchecked