Top Description Methods
org.hibernate.metamodel

public Interface MappingMetamodel

Known Direct Subinterfaces
org.hibernate.metamodel.spi.MappingMetamodelImplementor, org.hibernate.metamodel.spi.MetamodelImplementor
Annotations
@Incubating
Imports
java.util.List, java.util.function.Consumer, .Function, java.util.stream.Stream, org.hibernate.Incubating, org.hibernate.graph.RootGraph, org.hibernate.graph.spi.RootGraphImplementor, org.hibernate.metamodel.mapping.EmbeddableValuedModelPart, .MappingModelExpressible, org.hibernate.query.BindableType, org.hibernate.metamodel.model.domain.EntityDomainType, .NavigableRole, org.hibernate.persister.collection.CollectionPersister, org.hibernate.persister.entity.EntityPersister, org.hibernate.spi.NavigablePath, org.hibernate.query.sqm.SqmExpressible, org.hibernate.sql.ast.tree.from.TableGroup, org.hibernate.type.spi.TypeConfiguration

Access to information about the runtime relational O/R mapping model.
Author
Steve Ebersole

Method Summary

Modifier and TypeMethod and Description
public <T> void
addNamedEntityGraph(String graphName, RootGraphImplementor<T> entityGraph)

public RootGraph<?>
defaultGraph(String entityName)

public RootGraph<?>
defaultGraph(Class<T> entityJavaType)

public RootGraph<?>
defaultGraph(EntityPersister entityDescriptor)

public RootGraph<?>
defaultGraph(EntityDomainType<?> entityDomainType)

public CollectionPersister
findCollectionDescriptor(NavigableRole role)

Find a collection mapping descriptor based on its role.

public CollectionPersister
findCollectionDescriptor(String role)

Find a collection mapping descriptor based on its role.

public EntityPersister
findEntityDescriptor(String entityName)

Find an entity mapping descriptor based on its Hibernate entity-name.

public EntityPersister
findEntityDescriptor(Class<?> entityJavaType)

Find an entity mapping descriptor based on its Class.

public RootGraph<?>
public List<RootGraph<?>>
findRootGraphsForType(Class<T> baseEntityJavaType)

public List<RootGraph<?>>
findRootGraphsForType(String baseEntityName)

public List<RootGraph<?>>
findRootGraphsForType(EntityPersister baseEntityDescriptor)

public void
forEachCollectionDescriptor(Consumer<CollectionPersister> action)

Visit the mapping descriptors for all collections defined in the model

public void
forEachEntityDescriptor(Consumer<EntityPersister> action)

Visit all entity mapping descriptors defined in the model

public void
public CollectionPersister
getCollectionDescriptor(String role)

Get a collection mapping descriptor based on its role

public CollectionPersister
getCollectionDescriptor(NavigableRole role)

Get a collection mapping descriptor based on its role

public EmbeddableValuedModelPart
getEmbeddableValuedModelPart(NavigableRole role)

Get an EmbeddableMappingType based on its NavigableRole.

public EntityPersister
getEntityDescriptor(String entityName)

Get an entity mapping descriptor based on its Hibernate entity-name

public EntityPersister
getEntityDescriptor(NavigableRole name)

Get an entity mapping descriptor based on its NavigableRole.

public EntityPersister
getEntityDescriptor(Class<?> entityJavaType)

Get an entity mapping descriptor based on its Class.

public String
public TypeConfiguration
getTypeConfiguration()

The TypeConfiguration this metamodel is associated with

public boolean
isEntityClass(Class<?> entityJavaType)

public EntityPersister
locateEntityDescriptor(Class<?> byClass)

Locate an entity mapping descriptor by Class.

public default EntityPersister
locateEntityPersister(Class<?> byClass)

Deprecated since 6.0. use locateEntityDescriptor(Class) instead
public EntityPersister

Returns:

The located EntityPersister, never null
locateEntityPersister
(String byName)

Deprecated since 6.0. - use getEntityDescriptor(String) instead
Locate the entity persister by name.
public MappingModelExpressible<?>
public <T> BindableType<T>
resolveQueryParameterType(Class<T> javaType)

Given a Java type, determine the corresponding BindableType to use implicitly

public Stream<CollectionPersister>
public Stream<EntityPersister>

Method Detail

addNamedEntityGraphback to summary
public <T> void addNamedEntityGraph(String graphName, RootGraphImplementor<T> entityGraph)
defaultGraphback to summary
public RootGraph<?> defaultGraph(String entityName)
defaultGraphback to summary
public RootGraph<?> defaultGraph(Class<T> entityJavaType)
defaultGraphback to summary
public RootGraph<?> defaultGraph(EntityPersister entityDescriptor)
defaultGraphback to summary
public RootGraph<?> defaultGraph(EntityDomainType<?> entityDomainType)
findCollectionDescriptorback to summary
public CollectionPersister findCollectionDescriptor(NavigableRole role)

Find a collection mapping descriptor based on its role. Returns null if the role does not refer to a collection

See Also
findCollectionDescriptor
findCollectionDescriptorback to summary
public CollectionPersister findCollectionDescriptor(String role)

Find a collection mapping descriptor based on its role. Returns null if the role does not refer to a collection

See Also
findCollectionDescriptor
findEntityDescriptorback to summary
public EntityPersister findEntityDescriptor(String entityName)

Find an entity mapping descriptor based on its Hibernate entity-name.

API Note

Returns null rather than throwing exception

findEntityDescriptorback to summary
public EntityPersister findEntityDescriptor(Class<?> entityJavaType)

Find an entity mapping descriptor based on its Class.

API Note

Returns null rather than throwing exception

findNamedGraphback to summary
public RootGraph<?> findNamedGraph(String name)
findRootGraphsForTypeback to summary
public List<RootGraph<?>> findRootGraphsForType(Class<T> baseEntityJavaType)
findRootGraphsForTypeback to summary
public List<RootGraph<?>> findRootGraphsForType(String baseEntityName)
findRootGraphsForTypeback to summary
public List<RootGraph<?>> findRootGraphsForType(EntityPersister baseEntityDescriptor)
forEachCollectionDescriptorback to summary
public void forEachCollectionDescriptor(Consumer<CollectionPersister> action)

Visit the mapping descriptors for all collections defined in the model

forEachEntityDescriptorback to summary
public void forEachEntityDescriptor(Consumer<EntityPersister> action)

Visit all entity mapping descriptors defined in the model

forEachNamedGraphback to summary
public void forEachNamedGraph(Consumer<RootGraph<?>> action)
getCollectionDescriptorback to summary
public CollectionPersister getCollectionDescriptor(String role)

Get a collection mapping descriptor based on its role

Exceptions
IllegalArgumentException:
if the role does not refer to a collection
See Also
findCollectionDescriptor
getCollectionDescriptorback to summary
public CollectionPersister getCollectionDescriptor(NavigableRole role)

Get a collection mapping descriptor based on its role

Exceptions
IllegalArgumentException:
if the role does not refer to a collection
See Also
findCollectionDescriptor
getEmbeddableValuedModelPartback to summary
public EmbeddableValuedModelPart getEmbeddableValuedModelPart(NavigableRole role)

Get an EmbeddableMappingType based on its NavigableRole.

Exceptions
IllegalArgumentException:
if the role does not refer to an entity
See Also
findEntityDescriptor
getEntityDescriptorback to summary
public EntityPersister getEntityDescriptor(String entityName)

Get an entity mapping descriptor based on its Hibernate entity-name

Exceptions
IllegalArgumentException:
if the name does not refer to an entity
See Also
findEntityDescriptor
getEntityDescriptorback to summary
public EntityPersister getEntityDescriptor(NavigableRole name)

Get an entity mapping descriptor based on its NavigableRole.

Exceptions
IllegalArgumentException:
if the name does not refer to an entity
See Also
findEntityDescriptor
getEntityDescriptorback to summary
public EntityPersister getEntityDescriptor(Class<?> entityJavaType)

Get an entity mapping descriptor based on its Class.

Exceptions
IllegalArgumentException:
if the name does not refer to an entity
See Also
findEntityDescriptor
getImportedNameback to summary
public String getImportedName(String name)
getTypeConfigurationback to summary
public TypeConfiguration getTypeConfiguration()

The TypeConfiguration this metamodel is associated with

isEntityClassback to summary
public boolean isEntityClass(Class<?> entityJavaType)
locateEntityDescriptorback to summary
public EntityPersister locateEntityDescriptor(Class<?> byClass)

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.

Exceptions
UnknownEntityTypeException:
If a matching EntityPersister cannot be located
locateEntityPersisterback to summary
public default EntityPersister locateEntityPersister(Class<?> byClass)

Deprecated

since 6.0.

use locateEntityDescriptor(Class) instead

Annotations
@Deprecated
since:6.0
See Also
locateEntityDescriptor
locateEntityPersisterback to summary
public EntityPersister locateEntityPersister(String byName)

Deprecated

since 6.0.

- use getEntityDescriptor(String) instead

Locate the entity persister by name.

Returns:EntityPersister

The located EntityPersister, never null

Annotations
@Deprecated
since:6.0
Exceptions
UnknownEntityTypeException:
If a matching EntityPersister cannot be located
resolveMappingExpressibleback to summary
public MappingModelExpressible<?> resolveMappingExpressible(SqmExpressible<?> sqmExpressible, Function<NavigablePath, TableGroup> tableGroupLocator)
resolveQueryParameterTypeback to summary
public <T> BindableType<T> resolveQueryParameterType(Class<T> javaType)

Given a Java type, determine the corresponding BindableType to use implicitly

streamCollectionDescriptorsback to summary
public Stream<CollectionPersister> streamCollectionDescriptors()
streamEntityDescriptorsback to summary
public Stream<EntityPersister> streamEntityDescriptors()