Class MappingMetamodelImpl
- java.lang.Object
-
- org.hibernate.internal.QueryParameterBindingTypeResolverImpl
-
- org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl
-
- All Implemented Interfaces:
Metamodel
,Serializable
,Metamodel
,MappingMetamodel
,JpaMetamodel
,MappingMetamodelImplementor
,MetamodelImplementor
,QueryParameterBindingTypeResolver
public class MappingMetamodelImpl extends QueryParameterBindingTypeResolverImpl implements MappingMetamodelImplementor, MetamodelImplementor, Serializable
Implementation of the JPA-defined contractMetamodel
.Really more of the mapping model than the domain model, though it does have reference to the
JpaMetamodel
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MappingMetamodelImpl(TypeConfiguration typeConfiguration, ServiceRegistry serviceRegistry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> void
addNamedEntityGraph(String graphName, RootGraphImplementor<T> entityGraph)
void
close()
CollectionPersister
collectionPersister(String role)
Get the persister object for a collection role.Map<String,CollectionPersister>
collectionPersisters()
Get all collection persisters as a Map, which collection role as the key and the persister is the value.RootGraph<?>
defaultGraph(Class entityJavaType)
RootGraph<?>
defaultGraph(String entityName)
RootGraph<?>
defaultGraph(EntityDomainType<?> entityDomainType)
RootGraph<?>
defaultGraph(EntityPersister entityDescriptor)
<X> EmbeddableDomainType<X>
embeddable(Class<X> cls)
<X> EntityDomainType<X>
entity(Class<X> cls)
<X> EntityDomainType<X>
entity(String entityName)
Access to an entity supporting Hibernate's entity-name featureEntityPersister
entityPersister(Class<?> entityClass)
Locate the persister for an entity by the entity class.EntityPersister
entityPersister(String entityName)
Locate the persister for an entity by the entity-nameMap<String,EntityPersister>
entityPersisters()
Get all entity persisters as a Map, which entity name its the key and the persister is the value.<E extends Enum<E>>
EenumValue(EnumJavaType<E> enumType, String terminal)
CollectionPersister
findCollectionDescriptor(String role)
Find a collection mapping descriptor based on its role.CollectionPersister
findCollectionDescriptor(NavigableRole role)
Find a collection mapping descriptor based on its role.EntityPersister
findEntityDescriptor(Class<?> entityJavaType)
Find an entity mapping descriptor based on its Class.EntityPersister
findEntityDescriptor(String entityName)
Find an entity mapping descriptor based on its Hibernate entity-name.<T> RootGraphImplementor<T>
findEntityGraphByName(String name)
<T> List<RootGraphImplementor<? super T>>
findEntityGraphsByJavaType(Class<T> entityClass)
<X> EntityDomainType<X>
findEntityType(Class<X> cls)
Same asJpaMetamodel.entity(java.lang.String)
exceptnull
is returned rather than throwing an exception<X> ManagedDomainType<X>
findManagedType(Class<X> cls)
Same asJpaMetamodel.managedType(java.lang.Class<X>)
exceptnull
is returned rather than throwing an exceptionRootGraph<?>
findNamedGraph(String name)
List<RootGraph<?>>
findRootGraphsForType(Class baseEntityJavaType)
List<RootGraph<?>>
findRootGraphsForType(String baseEntityName)
List<RootGraph<?>>
findRootGraphsForType(EntityPersister baseEntityDescriptor)
void
finishInitialization(RuntimeModelCreationContext context)
void
forEachCollectionDescriptor(Consumer<CollectionPersister> action)
Visit the mapping descriptors for all collections defined in the modelvoid
forEachEntityDescriptor(Consumer<EntityPersister> action)
Visit all entity mapping descriptors defined in the modelvoid
forEachNamedGraph(Consumer<RootGraph<?>> action)
String[]
getAllCollectionRoles()
Get the names of all collections known to this MetamodelString[]
getAllEntityNames()
Get the names of all entities known to this MetamodelSet<String>
getAllowedEnumLiteralTexts(String enumValue)
CollectionPersister
getCollectionDescriptor(String role)
Get a collection mapping descriptor based on its roleCollectionPersister
getCollectionDescriptor(NavigableRole role)
Get a collection mapping descriptor based on its roleSet<String>
getCollectionRolesByEntityParticipant(String entityName)
Retrieves a set of all the collection roles in which the given entity is a participant, as either an index or an element.Set<EmbeddableType<?>>
getEmbeddables()
EmbeddableValuedModelPart
getEmbeddableValuedModelPart(NavigableRole role)
Get an EmbeddableMappingType based on its NavigableRole.Set<EntityType<?>>
getEntities()
EntityPersister
getEntityDescriptor(Class<?> entityJavaType)
Get an entity mapping descriptor based on its Class.EntityPersister
getEntityDescriptor(String entityName)
Get an entity mapping descriptor based on its Hibernate entity-nameEntityPersister
getEntityDescriptor(NavigableRole name)
Get an entity mapping descriptor based on its NavigableRole.Collection<EntityNameResolver>
getEntityNameResolvers()
Access to the EntityNameResolver instance that Hibernate is configured to use for determining the entity descriptor from an instance of an entityEnumJavaType<?>
getEnumType(String className)
<X> EntityDomainType<X>
getHqlEntityReference(String entityName)
Specialized handling for resolving entity-name references in an HQL queryString[]
getImplementors(String className)
Given the name of an entity class, determine all the class and interface names by which it can be referenced in an HQL query.String
getImportedName(String name)
JpaCompliance
getJpaCompliance()
JpaMetamodelImplementor
getJpaMetamodel()
Set<ManagedType<?>>
getManagedTypes()
MappingMetamodel
getMappingMetamodel()
ServiceRegistry
getServiceRegistry()
TypeConfiguration
getTypeConfiguration()
TheTypeConfiguration
this metamodel is associated withboolean
isEntityClass(Class<?> entityJavaType)
EntityPersister
locateEntityDescriptor(Class<?> byClass)
Locate an entity mapping descriptor by Class.EntityPersister
locateEntityPersister(String byName)
Locate the entity persister by name.<X> ManagedDomainType<X>
managedType(Class<X> cls)
String
qualifyImportableName(String queryName)
<X> EntityDomainType<X>
resolveHqlEntityReference(String entityName)
Specialized handling for resolving entity-name references in an HQL queryMappingModelExpressible<?>
resolveMappingExpressible(SqmExpressible<?> sqmExpressible, Function<NavigablePath,TableGroup> tableGroupLocator)
<T> BindableType<T>
resolveQueryParameterType(Class<T> javaClass)
Given a Java type, determine the corresponding BindableType to use implicitlyStream<CollectionPersister>
streamCollectionDescriptors()
Stream<EntityPersister>
streamEntityDescriptors()
-
Methods inherited from class org.hibernate.internal.QueryParameterBindingTypeResolverImpl
resolveParameterBindType, resolveParameterBindType
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.metamodel.MappingMetamodel
locateEntityPersister
-
Methods inherited from interface org.hibernate.query.spi.QueryParameterBindingTypeResolver
resolveParameterBindType, resolveParameterBindType
-
-
-
-
Constructor Detail
-
MappingMetamodelImpl
public MappingMetamodelImpl(TypeConfiguration typeConfiguration, ServiceRegistry serviceRegistry)
-
-
Method Detail
-
getJpaMetamodel
public JpaMetamodelImplementor getJpaMetamodel()
-
finishInitialization
public void finishInitialization(RuntimeModelCreationContext context)
-
getEntityNameResolvers
public Collection<EntityNameResolver> getEntityNameResolvers()
Description copied from interface:MappingMetamodelImplementor
Access to the EntityNameResolver instance that Hibernate is configured to use for determining the entity descriptor from an instance of an entity- Specified by:
getEntityNameResolvers
in interfaceMappingMetamodelImplementor
- Specified by:
getEntityNameResolvers
in interfaceMetamodelImplementor
-
getTypeConfiguration
public TypeConfiguration getTypeConfiguration()
Description copied from interface:MappingMetamodel
TheTypeConfiguration
this metamodel is associated with- Specified by:
getTypeConfiguration
in interfaceJpaMetamodel
- Specified by:
getTypeConfiguration
in interfaceMappingMetamodel
- Specified by:
getTypeConfiguration
in interfaceQueryParameterBindingTypeResolver
-
getMappingMetamodel
public MappingMetamodel getMappingMetamodel()
- Specified by:
getMappingMetamodel
in interfaceQueryParameterBindingTypeResolver
-
getServiceRegistry
public ServiceRegistry getServiceRegistry()
- Specified by:
getServiceRegistry
in interfaceJpaMetamodel
-
forEachEntityDescriptor
public void forEachEntityDescriptor(Consumer<EntityPersister> action)
Description copied from interface:MappingMetamodel
Visit all entity mapping descriptors defined in the model- Specified by:
forEachEntityDescriptor
in interfaceMappingMetamodel
-
streamEntityDescriptors
public Stream<EntityPersister> streamEntityDescriptors()
- Specified by:
streamEntityDescriptors
in interfaceMappingMetamodel
-
getEntityDescriptor
public EntityPersister getEntityDescriptor(String entityName)
Description copied from interface:MappingMetamodel
Get an entity mapping descriptor based on its Hibernate entity-name- Specified by:
getEntityDescriptor
in interfaceMappingMetamodel
- See Also:
MappingMetamodel.findEntityDescriptor(java.lang.String)
-
getEntityDescriptor
public EntityPersister getEntityDescriptor(NavigableRole name)
Description copied from interface:MappingMetamodel
Get an entity mapping descriptor based on its NavigableRole.- Specified by:
getEntityDescriptor
in interfaceMappingMetamodel
- See Also:
MappingMetamodel.findEntityDescriptor(java.lang.String)
-
getEmbeddableValuedModelPart
public EmbeddableValuedModelPart getEmbeddableValuedModelPart(NavigableRole role)
Description copied from interface:MappingMetamodel
Get an EmbeddableMappingType based on its NavigableRole.- Specified by:
getEmbeddableValuedModelPart
in interfaceMappingMetamodel
- See Also:
MappingMetamodel.findEntityDescriptor(java.lang.String)
-
findEntityDescriptor
public EntityPersister findEntityDescriptor(String entityName)
Description copied from interface:MappingMetamodel
Find an entity mapping descriptor based on its Hibernate entity-name.- Specified by:
findEntityDescriptor
in interfaceMappingMetamodel
-
findEntityDescriptor
public EntityPersister findEntityDescriptor(Class<?> entityJavaType)
Description copied from interface:MappingMetamodel
Find an entity mapping descriptor based on its Class.- Specified by:
findEntityDescriptor
in interfaceMappingMetamodel
-
isEntityClass
public boolean isEntityClass(Class<?> entityJavaType)
- Specified by:
isEntityClass
in interfaceMappingMetamodel
-
getEntityDescriptor
public EntityPersister getEntityDescriptor(Class<?> entityJavaType)
Description copied from interface:MappingMetamodel
Get an entity mapping descriptor based on its Class.- Specified by:
getEntityDescriptor
in interfaceMappingMetamodel
- See Also:
MappingMetamodel.findEntityDescriptor(java.lang.String)
-
locateEntityDescriptor
public EntityPersister locateEntityDescriptor(Class<?> byClass)
Description copied from interface:MappingMetamodel
Locate an entity mapping descriptor by Class. The passed Class might refer to either the entity Class directly, or it might name a proxy interface for the entity. This method accounts for both, preferring the direct entity name.- Specified by:
locateEntityDescriptor
in interfaceMappingMetamodel
-
entity
public <X> EntityDomainType<X> entity(Class<X> cls)
- Specified by:
entity
in interfaceJpaMetamodel
- Specified by:
entity
in interfaceMetamodel
-
managedType
public <X> ManagedDomainType<X> managedType(Class<X> cls)
- Specified by:
managedType
in interfaceJpaMetamodel
- Specified by:
managedType
in interfaceMetamodel
-
embeddable
public <X> EmbeddableDomainType<X> embeddable(Class<X> cls)
- Specified by:
embeddable
in interfaceJpaMetamodel
- Specified by:
embeddable
in interfaceMetamodel
-
getManagedTypes
public Set<ManagedType<?>> getManagedTypes()
- Specified by:
getManagedTypes
in interfaceJpaMetamodel
- Specified by:
getManagedTypes
in interfaceMetamodel
-
getEntities
public Set<EntityType<?>> getEntities()
- Specified by:
getEntities
in interfaceJpaMetamodel
- Specified by:
getEntities
in interfaceMetamodel
-
getEmbeddables
public Set<EmbeddableType<?>> getEmbeddables()
- Specified by:
getEmbeddables
in interfaceJpaMetamodel
- Specified by:
getEmbeddables
in interfaceMetamodel
-
entity
public <X> EntityDomainType<X> entity(String entityName)
Description copied from interface:JpaMetamodel
Access to an entity supporting Hibernate's entity-name feature- Specified by:
entity
in interfaceJpaMetamodel
-
getHqlEntityReference
public <X> EntityDomainType<X> getHqlEntityReference(String entityName)
Description copied from interface:JpaMetamodel
Specialized handling for resolving entity-name references in an HQL query- Specified by:
getHqlEntityReference
in interfaceJpaMetamodel
-
resolveHqlEntityReference
public <X> EntityDomainType<X> resolveHqlEntityReference(String entityName)
Description copied from interface:JpaMetamodel
Specialized handling for resolving entity-name references in an HQL query- Specified by:
resolveHqlEntityReference
in interfaceJpaMetamodel
-
findManagedType
public <X> ManagedDomainType<X> findManagedType(Class<X> cls)
Description copied from interface:JpaMetamodel
Same asJpaMetamodel.managedType(java.lang.Class<X>)
exceptnull
is returned rather than throwing an exception- Specified by:
findManagedType
in interfaceJpaMetamodel
-
findEntityType
public <X> EntityDomainType<X> findEntityType(Class<X> cls)
Description copied from interface:JpaMetamodel
Same asJpaMetamodel.entity(java.lang.String)
exceptnull
is returned rather than throwing an exception- Specified by:
findEntityType
in interfaceJpaMetamodel
-
qualifyImportableName
public String qualifyImportableName(String queryName)
- Specified by:
qualifyImportableName
in interfaceJpaMetamodel
-
getAllowedEnumLiteralTexts
public Set<String> getAllowedEnumLiteralTexts(String enumValue)
- Specified by:
getAllowedEnumLiteralTexts
in interfaceJpaMetamodel
-
getEnumType
public EnumJavaType<?> getEnumType(String className)
- Specified by:
getEnumType
in interfaceJpaMetamodel
-
enumValue
public <E extends Enum<E>> E enumValue(EnumJavaType<E> enumType, String terminal)
- Specified by:
enumValue
in interfaceJpaMetamodel
-
getImplementors
public String[] getImplementors(String className) throws MappingException
Description copied from interface:Metamodel
Given the name of an entity class, determine all the class and interface names by which it can be referenced in an HQL query.- Specified by:
getImplementors
in interfaceMetamodel
- Parameters:
className
- The name of the entity class- Returns:
- the names of all persistent (mapped) classes that extend or implement the given class or interface, accounting for implicit/explicit polymorphism settings and excluding mapped subclasses/joined-subclasses of other classes in the result.
- Throws:
MappingException
-
entityPersisters
public Map<String,EntityPersister> entityPersisters()
Description copied from interface:MetamodelImplementor
Get all entity persisters as a Map, which entity name its the key and the persister is the value.- Specified by:
entityPersisters
in interfaceMetamodelImplementor
- Returns:
- The Map contains all entity persisters.
-
collectionPersister
public CollectionPersister collectionPersister(String role)
Description copied from interface:MetamodelImplementor
Get the persister object for a collection role.- Specified by:
collectionPersister
in interfaceMetamodelImplementor
- Parameters:
role
- The role of the collection for which to retrieve the persister.- Returns:
- The persister
-
collectionPersisters
public Map<String,CollectionPersister> collectionPersisters()
Description copied from interface:MetamodelImplementor
Get all collection persisters as a Map, which collection role as the key and the persister is the value.- Specified by:
collectionPersisters
in interfaceMetamodelImplementor
- Returns:
- The Map contains all collection persisters.
-
entityPersister
public EntityPersister entityPersister(Class<?> entityClass)
Description copied from interface:MetamodelImplementor
Locate the persister for an entity by the entity class.- Specified by:
entityPersister
in interfaceMetamodelImplementor
- Parameters:
entityClass
- The entity class- Returns:
- The entity persister
-
entityPersister
public EntityPersister entityPersister(String entityName) throws MappingException
Description copied from interface:MetamodelImplementor
Locate the persister for an entity by the entity-name- Specified by:
entityPersister
in interfaceMetamodelImplementor
- Parameters:
entityName
- The name of the entity for which to retrieve the persister.- Returns:
- The persister
- Throws:
MappingException
- Indicates persister could not be found with that name.
-
locateEntityPersister
public EntityPersister locateEntityPersister(String byName)
Description copied from interface:MappingMetamodel
Locate the entity persister by name.- Specified by:
locateEntityPersister
in interfaceMappingMetamodel
- Returns:
- The located EntityPersister, never
null
-
getImportedName
public String getImportedName(String name)
- Specified by:
getImportedName
in interfaceMappingMetamodel
-
forEachCollectionDescriptor
public void forEachCollectionDescriptor(Consumer<CollectionPersister> action)
Description copied from interface:MappingMetamodel
Visit the mapping descriptors for all collections defined in the model- Specified by:
forEachCollectionDescriptor
in interfaceMappingMetamodel
-
streamCollectionDescriptors
public Stream<CollectionPersister> streamCollectionDescriptors()
- Specified by:
streamCollectionDescriptors
in interfaceMappingMetamodel
-
getCollectionDescriptor
public CollectionPersister getCollectionDescriptor(String role)
Description copied from interface:MappingMetamodel
Get a collection mapping descriptor based on its role- Specified by:
getCollectionDescriptor
in interfaceMappingMetamodel
- See Also:
MappingMetamodel.findCollectionDescriptor(org.hibernate.metamodel.model.domain.NavigableRole)
-
getCollectionDescriptor
public CollectionPersister getCollectionDescriptor(NavigableRole role)
Description copied from interface:MappingMetamodel
Get a collection mapping descriptor based on its role- Specified by:
getCollectionDescriptor
in interfaceMappingMetamodel
- See Also:
MappingMetamodel.findCollectionDescriptor(org.hibernate.metamodel.model.domain.NavigableRole)
-
findCollectionDescriptor
public CollectionPersister findCollectionDescriptor(NavigableRole role)
Description copied from interface:MappingMetamodel
Find a collection mapping descriptor based on its role. Returnsnull
if the role does not refer to a collection- Specified by:
findCollectionDescriptor
in interfaceMappingMetamodel
- See Also:
MappingMetamodel.findCollectionDescriptor(org.hibernate.metamodel.model.domain.NavigableRole)
-
findCollectionDescriptor
public CollectionPersister findCollectionDescriptor(String role)
Description copied from interface:MappingMetamodel
Find a collection mapping descriptor based on its role. Returnsnull
if the role does not refer to a collection- Specified by:
findCollectionDescriptor
in interfaceMappingMetamodel
- See Also:
MappingMetamodel.findCollectionDescriptor(org.hibernate.metamodel.model.domain.NavigableRole)
-
getCollectionRolesByEntityParticipant
public Set<String> getCollectionRolesByEntityParticipant(String entityName)
Description copied from interface:MappingMetamodelImplementor
Retrieves a set of all the collection roles in which the given entity is a participant, as either an index or an element.- Specified by:
getCollectionRolesByEntityParticipant
in interfaceMappingMetamodelImplementor
- Specified by:
getCollectionRolesByEntityParticipant
in interfaceMetamodelImplementor
- Parameters:
entityName
- The entity name for which to get the collection roles.- Returns:
- set of all the collection roles in which the given entityName participates.
-
getAllEntityNames
public String[] getAllEntityNames()
Description copied from interface:MetamodelImplementor
Get the names of all entities known to this Metamodel- Specified by:
getAllEntityNames
in interfaceMetamodelImplementor
- Returns:
- All the entity names
-
getAllCollectionRoles
public String[] getAllCollectionRoles()
Description copied from interface:MetamodelImplementor
Get the names of all collections known to this Metamodel- Specified by:
getAllCollectionRoles
in interfaceMetamodelImplementor
- Returns:
- All the entity names
-
addNamedEntityGraph
public <T> void addNamedEntityGraph(String graphName, RootGraphImplementor<T> entityGraph)
- Specified by:
addNamedEntityGraph
in interfaceJpaMetamodel
- Specified by:
addNamedEntityGraph
in interfaceMappingMetamodel
-
findEntityGraphByName
public <T> RootGraphImplementor<T> findEntityGraphByName(String name)
- Specified by:
findEntityGraphByName
in interfaceJpaMetamodel
-
findEntityGraphsByJavaType
public <T> List<RootGraphImplementor<? super T>> findEntityGraphsByJavaType(Class<T> entityClass)
- Specified by:
findEntityGraphsByJavaType
in interfaceJpaMetamodel
-
getJpaCompliance
public JpaCompliance getJpaCompliance()
- Specified by:
getJpaCompliance
in interfaceJpaMetamodel
-
findNamedGraph
public RootGraph<?> findNamedGraph(String name)
- Specified by:
findNamedGraph
in interfaceMappingMetamodel
-
forEachNamedGraph
public void forEachNamedGraph(Consumer<RootGraph<?>> action)
- Specified by:
forEachNamedGraph
in interfaceMappingMetamodel
-
defaultGraph
public RootGraph<?> defaultGraph(String entityName)
- Specified by:
defaultGraph
in interfaceMappingMetamodel
-
defaultGraph
public RootGraph<?> defaultGraph(Class entityJavaType)
- Specified by:
defaultGraph
in interfaceMappingMetamodel
-
defaultGraph
public RootGraph<?> defaultGraph(EntityPersister entityDescriptor)
- Specified by:
defaultGraph
in interfaceMappingMetamodel
-
defaultGraph
public RootGraph<?> defaultGraph(EntityDomainType<?> entityDomainType)
- Specified by:
defaultGraph
in interfaceMappingMetamodel
-
findRootGraphsForType
public List<RootGraph<?>> findRootGraphsForType(Class baseEntityJavaType)
- Specified by:
findRootGraphsForType
in interfaceMappingMetamodel
-
findRootGraphsForType
public List<RootGraph<?>> findRootGraphsForType(String baseEntityName)
- Specified by:
findRootGraphsForType
in interfaceMappingMetamodel
-
findRootGraphsForType
public List<RootGraph<?>> findRootGraphsForType(EntityPersister baseEntityDescriptor)
- Specified by:
findRootGraphsForType
in interfaceMappingMetamodel
-
close
public void close()
- Specified by:
close
in interfaceMetamodelImplementor
-
resolveMappingExpressible
public MappingModelExpressible<?> resolveMappingExpressible(SqmExpressible<?> sqmExpressible, Function<NavigablePath,TableGroup> tableGroupLocator)
- Specified by:
resolveMappingExpressible
in interfaceMappingMetamodel
-
resolveQueryParameterType
public <T> BindableType<T> resolveQueryParameterType(Class<T> javaClass)
Description copied from interface:MappingMetamodel
Given a Java type, determine the corresponding BindableType to use implicitly- Specified by:
resolveQueryParameterType
in interfaceMappingMetamodel
-
-