Package org.hibernate.boot.internal
Class MetadataImpl
- java.lang.Object
-
- org.hibernate.boot.internal.MetadataImpl
-
- All Implemented Interfaces:
Serializable
,Metadata
,MetadataImplementor
,Mapping
public class MetadataImpl extends Object implements MetadataImplementor, Serializable
Container for configuration data collected during binding the metamodel.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MetadataImpl(UUID uuid, MetadataBuildingOptions metadataBuildingOptions, Map<String,PersistentClass> entityBindingMap, List<Component> composites, Map<Class<?>,Component> genericComponentsMap, Map<Class<?>,MappedSuperclass> mappedSuperclassMap, Map<String,Collection> collectionBindingMap, Map<String,TypeDefinition> typeDefinitionMap, Map<String,FilterDefinition> filterDefinitionMap, Map<String,FetchProfile> fetchProfileMap, Map<String,String> imports, Map<String,IdentifierGeneratorDefinition> idGeneratorDefinitionMap, Map<String,NamedHqlQueryDefinition> namedQueryMap, Map<String,NamedNativeQueryDefinition> namedNativeQueryMap, Map<String,NamedProcedureCallDefinition> namedProcedureCallMap, Map<String,NamedResultSetMappingDescriptor> sqlResultSetMappingMap, Map<String,NamedEntityGraphDefinition> namedEntityGraphMap, Map<String,SqmFunctionDescriptor> sqlFunctionMap, Database database, BootstrapContext bootstrapContext)
-
Method Summary
-
-
-
Constructor Detail
-
MetadataImpl
public MetadataImpl(UUID uuid, MetadataBuildingOptions metadataBuildingOptions, Map<String,PersistentClass> entityBindingMap, List<Component> composites, Map<Class<?>,Component> genericComponentsMap, Map<Class<?>,MappedSuperclass> mappedSuperclassMap, Map<String,Collection> collectionBindingMap, Map<String,TypeDefinition> typeDefinitionMap, Map<String,FilterDefinition> filterDefinitionMap, Map<String,FetchProfile> fetchProfileMap, Map<String,String> imports, Map<String,IdentifierGeneratorDefinition> idGeneratorDefinitionMap, Map<String,NamedHqlQueryDefinition> namedQueryMap, Map<String,NamedNativeQueryDefinition> namedNativeQueryMap, Map<String,NamedProcedureCallDefinition> namedProcedureCallMap, Map<String,NamedResultSetMappingDescriptor> sqlResultSetMappingMap, Map<String,NamedEntityGraphDefinition> namedEntityGraphMap, Map<String,SqmFunctionDescriptor> sqlFunctionMap, Database database, BootstrapContext bootstrapContext)
-
-
Method Detail
-
getMetadataBuildingOptions
public MetadataBuildingOptions getMetadataBuildingOptions()
Description copied from interface:MetadataImplementor
Access to the options used to build thisMetadata
- Specified by:
getMetadataBuildingOptions
in interfaceMetadataImplementor
- Returns:
- The
MetadataBuildingOptions
-
getTypeConfiguration
public TypeConfiguration getTypeConfiguration()
Description copied from interface:MetadataImplementor
Access to theTypeConfiguration
belonging to theBootstrapContext
- Specified by:
getTypeConfiguration
in interfaceMetadataImplementor
-
getFunctionRegistry
public SqmFunctionRegistry getFunctionRegistry()
Description copied from interface:MetadataImplementor
Access to theSqmFunctionRegistry
belonging to theBootstrapContext
- Specified by:
getFunctionRegistry
in interfaceMetadataImplementor
-
getSessionFactoryBuilder
public SessionFactoryBuilder getSessionFactoryBuilder()
Description copied from interface:Metadata
Get the builder forSessionFactory
instances based on this metamodel.- Specified by:
getSessionFactoryBuilder
in interfaceMetadata
- Returns:
- The builder for
SessionFactory
instances.
-
buildSessionFactory
public SessionFactory buildSessionFactory()
Description copied from interface:Metadata
Short-hand form of building aSessionFactory
through the builder without any additional option overrides.- Specified by:
buildSessionFactory
in interfaceMetadata
- Returns:
- THe built SessionFactory.
-
getUUID
public UUID getUUID()
Description copied from interface:Metadata
Gets theUUID
for this metamodel.
-
getDatabase
public Database getDatabase()
Description copied from interface:Metadata
Retrieve the database model.- Specified by:
getDatabase
in interfaceMetadata
- Returns:
- The database model.
-
getEntityBindings
public Collection<PersistentClass> getEntityBindings()
Description copied from interface:Metadata
Retrieves the PersistentClass entity metadata representation for all known entities. Returned collection is immutable- Specified by:
getEntityBindings
in interfaceMetadata
- Returns:
- All PersistentClass representations.
-
getEntityBinding
public PersistentClass getEntityBinding(String entityName)
Description copied from interface:Metadata
Retrieves the PersistentClass entity mapping metadata representation for the given entity name.- Specified by:
getEntityBinding
in interfaceMetadata
- Parameters:
entityName
- The entity name for which to retrieve the metadata.- Returns:
- The entity mapping metadata, or
null
if no matching entity found.
-
getCollectionBindings
public Collection<Collection> getCollectionBindings()
Description copied from interface:Metadata
Retrieves the Collection metadata representation for all known collections. Returned collection is immutable- Specified by:
getCollectionBindings
in interfaceMetadata
- Returns:
- All Collection representations.
-
getCollectionBinding
public Collection getCollectionBinding(String role)
Description copied from interface:Metadata
Retrieves the collection mapping metadata for the given collection role.- Specified by:
getCollectionBinding
in interfaceMetadata
- Parameters:
role
- The collection role for which to retrieve the metadata.- Returns:
- The collection mapping metadata, or
null
if no matching collection found.
-
getImports
public Map<String,String> getImports()
Description copied from interface:Metadata
Retrieves all defined imports (class renames).- Specified by:
getImports
in interfaceMetadata
- Returns:
- All imports
-
getNamedHqlQueryMapping
public NamedHqlQueryDefinition getNamedHqlQueryMapping(String name)
Description copied from interface:Metadata
Retrieve named query metadata by name.- Specified by:
getNamedHqlQueryMapping
in interfaceMetadata
- Returns:
- The named query metadata, or
null
.
-
visitNamedHqlQueryDefinitions
public void visitNamedHqlQueryDefinitions(Consumer<NamedHqlQueryDefinition> definitionConsumer)
Description copied from interface:Metadata
Visit all named HQL query definitions- Specified by:
visitNamedHqlQueryDefinitions
in interfaceMetadata
-
getNamedNativeQueryMapping
public NamedNativeQueryDefinition getNamedNativeQueryMapping(String name)
Description copied from interface:Metadata
Retrieve named SQL query metadata.- Specified by:
getNamedNativeQueryMapping
in interfaceMetadata
- Returns:
- The named query metadata, or
null
-
visitNamedNativeQueryDefinitions
public void visitNamedNativeQueryDefinitions(Consumer<NamedNativeQueryDefinition> definitionConsumer)
Description copied from interface:Metadata
Visit all named native query definitions- Specified by:
visitNamedNativeQueryDefinitions
in interfaceMetadata
-
getNamedProcedureCallMapping
public NamedProcedureCallDefinition getNamedProcedureCallMapping(String name)
Description copied from interface:Metadata
Retrieve named procedure metadata.- Specified by:
getNamedProcedureCallMapping
in interfaceMetadata
- Returns:
- The named procedure metadata, or
null
-
visitNamedProcedureCallDefinition
public void visitNamedProcedureCallDefinition(Consumer<NamedProcedureCallDefinition> definitionConsumer)
Description copied from interface:Metadata
Visit all named callable query definitions- Specified by:
visitNamedProcedureCallDefinition
in interfaceMetadata
-
getResultSetMapping
public NamedResultSetMappingDescriptor getResultSetMapping(String name)
Description copied from interface:Metadata
Retrieve the metadata for a named SQL result set mapping.- Specified by:
getResultSetMapping
in interfaceMetadata
- Parameters:
name
- The mapping name.- Returns:
- The named result set mapping metadata, or
null
if none found.
-
visitNamedResultSetMappingDefinition
public void visitNamedResultSetMappingDefinition(Consumer<NamedResultSetMappingDescriptor> definitionConsumer)
Description copied from interface:Metadata
Visit all named SQL result set mapping definitions- Specified by:
visitNamedResultSetMappingDefinition
in interfaceMetadata
-
getTypeDefinition
public TypeDefinition getTypeDefinition(String typeName)
Description copied from interface:Metadata
Retrieve a type definition by name.- Specified by:
getTypeDefinition
in interfaceMetadata
- Returns:
- The named type definition, or
null
-
getFilterDefinitions
public Map<String,FilterDefinition> getFilterDefinitions()
Description copied from interface:Metadata
Retrieves the complete map of filter definitions. Returned map is immutable- Specified by:
getFilterDefinitions
in interfaceMetadata
- Returns:
- The filter definition map.
-
getFilterDefinition
public FilterDefinition getFilterDefinition(String name)
Description copied from interface:Metadata
Retrieves a filter definition by name.- Specified by:
getFilterDefinition
in interfaceMetadata
- Parameters:
name
- The name of the filter definition to retrieve .- Returns:
- The filter definition, or
null
.
-
getFetchProfile
public FetchProfile getFetchProfile(String name)
- Specified by:
getFetchProfile
in interfaceMetadata
-
getFetchProfiles
public Collection<FetchProfile> getFetchProfiles()
- Specified by:
getFetchProfiles
in interfaceMetadata
-
getNamedEntityGraph
public NamedEntityGraphDefinition getNamedEntityGraph(String name)
- Specified by:
getNamedEntityGraph
in interfaceMetadata
-
getNamedEntityGraphs
public Map<String,NamedEntityGraphDefinition> getNamedEntityGraphs()
- Specified by:
getNamedEntityGraphs
in interfaceMetadata
-
getIdentifierGenerator
public IdentifierGeneratorDefinition getIdentifierGenerator(String name)
- Specified by:
getIdentifierGenerator
in interfaceMetadata
-
getSqlFunctionMap
public Map<String,SqmFunctionDescriptor> getSqlFunctionMap()
- Specified by:
getSqlFunctionMap
in interfaceMetadata
-
getContributors
public Set<String> getContributors()
Description copied from interface:Metadata
All of the known model contributors- Specified by:
getContributors
in interfaceMetadata
-
collectTableMappings
public Collection<Table> collectTableMappings()
- Specified by:
collectTableMappings
in interfaceMetadata
-
buildNamedQueryRepository
public NamedObjectRepository buildNamedQueryRepository(SessionFactoryImplementor sessionFactory)
- Specified by:
buildNamedQueryRepository
in interfaceMetadataImplementor
-
orderColumns
public void orderColumns(boolean forceOrdering)
- Specified by:
orderColumns
in interfaceMetadataImplementor
-
validate
public void validate() throws MappingException
- Specified by:
validate
in interfaceMetadataImplementor
- Throws:
MappingException
-
getMappedSuperclassMappingsCopy
public Set<MappedSuperclass> getMappedSuperclassMappingsCopy()
- Specified by:
getMappedSuperclassMappingsCopy
in interfaceMetadataImplementor
-
initSessionFactory
public void initSessionFactory(SessionFactoryImplementor sessionFactory)
- Specified by:
initSessionFactory
in interfaceMetadataImplementor
-
visitRegisteredComponents
public void visitRegisteredComponents(Consumer<Component> consumer)
- Specified by:
visitRegisteredComponents
in interfaceMetadataImplementor
-
getGenericComponent
public Component getGenericComponent(Class<?> componentClass)
- Specified by:
getGenericComponent
in interfaceMetadataImplementor
-
getIdentifierType
public Type getIdentifierType(String entityName) throws MappingException
- Specified by:
getIdentifierType
in interfaceMapping
- Throws:
MappingException
-
getIdentifierPropertyName
public String getIdentifierPropertyName(String entityName) throws MappingException
- Specified by:
getIdentifierPropertyName
in interfaceMapping
- Throws:
MappingException
-
getReferencedPropertyType
public Type getReferencedPropertyType(String entityName, String propertyName) throws MappingException
- Specified by:
getReferencedPropertyType
in interfaceMapping
- Throws:
MappingException
-
getEntityBindingMap
public Map<String,PersistentClass> getEntityBindingMap()
-
getCollectionBindingMap
public Map<String,Collection> getCollectionBindingMap()
-
getTypeDefinitionMap
public Map<String,TypeDefinition> getTypeDefinitionMap()
-
getFetchProfileMap
public Map<String,FetchProfile> getFetchProfileMap()
-
getMappedSuperclassMap
public Map<Class<?>,MappedSuperclass> getMappedSuperclassMap()
-
getIdGeneratorDefinitionMap
public Map<String,IdentifierGeneratorDefinition> getIdGeneratorDefinitionMap()
-
getNamedEntityGraphMap
public Map<String,NamedEntityGraphDefinition> getNamedEntityGraphMap()
-
getBootstrapContext
public BootstrapContext getBootstrapContext()
-
getNamedQueryMap
public Map<String,NamedHqlQueryDefinition> getNamedQueryMap()
-
getNamedNativeQueryMap
public Map<String,NamedNativeQueryDefinition> getNamedNativeQueryMap()
-
getNamedProcedureCallMap
public Map<String,NamedProcedureCallDefinition> getNamedProcedureCallMap()
-
getSqlResultSetMappingMap
public Map<String,NamedResultSetMappingDescriptor> getSqlResultSetMappingMap()
-
-