protected class

Configuration.MappingsImpl

extends Object
implements Serializable ExtendedMappings
java.lang.Object
   ↳ org.hibernate.cfg.Configuration.MappingsImpl
Known Direct Subclasses

Class Overview

Internal implementation of the Mappings interface giving access to the Configuration's internal metadata repository state (classes, tables, etc).

Summary

Protected Constructors
Configuration.MappingsImpl()
Public Methods
void addAnyMetaDef(AnyMetaDef defAnn)
void addAuxiliaryDatabaseObject(AuxiliaryDatabaseObject auxiliaryDatabaseObject)
Add metadata pertaining to an auxiliary database object to this repository.
void addClass(PersistentClass persistentClass)
Add entity mapping metadata.
AnnotatedClassType addClassType(XClass clazz)
FIXME should be private but will this break things? Add a class type.
void addCollection(Collection collection)
Add collection mapping metadata to this repository.
void addColumnBinding(String logicalName, Column physicalColumn, Table table)
Binds the given 'physicalColumn' to the give 'logicalName' within the given 'table'.
void addDefaultGenerator(IdGenerator generator)
Adds a default id generator.
void addDefaultQuery(String name, NamedQueryDefinition query)
void addDefaultResultSetMapping(ResultSetMappingDefinition definition)
void addDefaultSQLQuery(String name, NamedSQLQueryDefinition query)
Table addDenormalizedTable(String schema, String catalog, String name, boolean isAbstract, String subselect, Table includedTable)
Adds a 'denormalized table' to this repository.
void addFilterDefinition(FilterDefinition definition)
Adds a filter definition to this repository.
void addGenerator(IdGenerator generator)
Add a generator.
void addGeneratorTable(String name, Properties params)
Add a generator table properties.
void addImport(String entityName, String rename)
Adds an import (HQL entity rename) to the repository.
void addJoins(PersistentClass persistentClass, Map<StringJoin> joins)
Add join metadata for a persistent entity.
void addMappedBy(String entityName, String propertyName, String inversePropertyName)
void addMappedSuperclass(Class type, MappedSuperclass mappedSuperclass)
add a new MappedSuperclass This should not be called if the MappedSuperclass already exists (it would be erased)
void addPropertyAnnotatedWithMapsId(XClass entityType, PropertyData property)
void addPropertyAnnotatedWithMapsIdSpecj(XClass entityType, PropertyData property, String mapsIdValue)
void addPropertyReference(String referencedClass, String propertyName)
Adds a property reference binding to this repository.
void addPropertyReferencedAssociation(String entityName, String propertyName, String propertyRef)
void addQuery(String name, NamedQueryDefinition query)
Adds metadata for a named query to this repository.
void addResultSetMapping(ResultSetMappingDefinition sqlResultSetMapping)
Adds the metadata for a named SQL result set mapping to this repository.
void addSQLQuery(String name, NamedSQLQueryDefinition query)
Adds metadata for a named SQL query to this repository.
void addSecondPass(SecondPass sp)
Adds a second-pass to the end of the current queue.
void addSecondPass(SecondPass sp, boolean onTopOfTheQueue)
Adds a second pass.
Table addTable(String schema, String catalog, String name, String subselect, boolean isAbstract)
Adds table metadata to this repository returning the created metadata instance.
void addTableBinding(String schema, String catalog, String logicalName, String physicalName, Table denormalizedSuperTable)
Adds a table binding to this repository.
void addToExtendsQueue(ExtendsQueueEntry entry)
Adds an entry to the extends queue queue.
void addToOneAndIdProperty(XClass entityType, PropertyData property)
void addTypeDef(String typeName, String typeClass, Properties paramMap)
Adds a type definition to this metadata repository.
void addUniqueConstraintHolders(Table table, List<UniqueConstraintHolder> uniqueConstraintHolders)
void addUniqueConstraints(Table table, List uniqueConstraints)
void addUniquePropertyReference(String referencedClass, String propertyName)
Adds a property reference binding to this repository where said proeprty reference is marked as unique.
void applyResultSetMapping(ResultSetMappingDefinition sqlResultSetMapping)
FetchProfile findOrCreateFetchProfile(String name, MetadataSource source)
Retrieves a fetch profile by either finding one currently in this repository matching the given name or by creating one (and adding it).
AnyMetaDef getAnyMetaDef(String name)
String getCatalogName()
Returns the currently bound default catalog name.
PersistentClass getClass(String entityName)
Retrieves the entity mapping metadata for the given entity name.
AnnotatedClassType getClassType(XClass clazz)
Get and maintain a cache of class type.
Map getClasses()
Collection getCollection(String role)
Retrieves the collection mapping metadata for the given collection role.
Properties getConfigurationProperties()
Retrieve the configuration properties currently in effect.
String getDefaultAccess()
Get the current default property access style.
String getDefaultCascade()
Get the current default cascade style.
String getDefaultPackage()
Get the currently bound default package name.
FilterDefinition getFilterDefinition(String name)
Retrieves a filter definition by name.
Map getFilterDefinitions()
Retrieves the copmplete map of filter definitions.
String getFromMappedBy(String entityName, String propertyName)
IdGenerator getGenerator(String name)
Retrieve the id-generator by name.
IdGenerator getGenerator(String name, Map<StringIdGenerator> localGenerators)
Try to find the generator from the localGenerators and then from the global generator list
Properties getGeneratorTableProperties(String name, Map<StringProperties> localGeneratorTables)
Retrieve the properties related to a generator table.
DefaultIdentifierGeneratorFactory getIdentifierGeneratorFactory()
Retrieve the IdentifierGeneratorFactory in effect for this mapping.
Map<StringJoin> getJoins(String entityName)
Retrieve join metadata for a particular persistent entity.
String getLogicalColumnName(String physicalName, Table table)
Find the logical column name against whcih the given physical column name was bound within the given table.
String getLogicalTableName(Table table)
Get the logical table name mapped for the given physical table.
MappedSuperclass getMappedSuperclass(Class type)
Get a MappedSuperclass or null if not mapped
NamingStrategy getNamingStrategy()
Get the current naming strategy.
ObjectNameNormalizer getObjectNameNormalizer()
Retrieve the database identifier normalizer for this context.
PersisterClassProvider getPersisterClassProvider()
Get the current persister class provider implementation
String getPhysicalColumnName(String logicalName, Table table)
Find the physical column name for the given logical column name within the given table.
PropertyData getPropertyAnnotatedWithIdAndToOne(XClass entityType, String propertyName)
Return the property annotated with @ToOne and @Id if any.
PropertyData getPropertyAnnotatedWithMapsId(XClass entityType, String propertyName)
Return the property annotated with @MapsId("propertyName") if any.
String getPropertyReferencedAssociation(String entityName, String propertyName)
NamedQueryDefinition getQuery(String name)
Get named query metadata by name.
ReflectionManager getReflectionManager()
ResultSetMappingDefinition getResultSetMapping(String name)
Get the metadata for a named SQL result set mapping.
NamedSQLQueryDefinition getSQLQuery(String name)
Get named SQL query metadata.
String getSchemaName()
Returns the currently bound default schema name.
Table getTable(String schema, String catalog, String name)
Returns the named table metadata.
Map<TableList<String[]>> getTableUniqueConstraints()
TypeDef getTypeDef(String typeName)
Retrieve a type definition by name.
TypeResolver getTypeResolver()
Retrieve the type resolver in effect.
Map<TableList<UniqueConstraintHolder>> getUniqueConstraintHoldersByTable()
boolean isAutoImport()
Determine whether auto importing of entity names is currently enabled.
boolean isDefaultLazy()
Determine whether default laziness is currently enabled.
boolean isInSecondPass()
boolean isSpecjProprietarySyntaxEnabled()
Iterator<AuxiliaryDatabaseObject> iterateAuxiliaryDatabaseObjects()
Retrieves an iterator over the metadata pertaining to all auxiliary database objects int this repository.
ListIterator<AuxiliaryDatabaseObject> iterateAuxiliaryDatabaseObjectsInReverse()
Same as iterateAuxiliaryDatabaseObjects() except that here the iterator is reversed.
Iterator<AuxiliaryDatabaseObject> iterateAuxliaryDatabaseObjects()
ListIterator<AuxiliaryDatabaseObject> iterateAuxliaryDatabaseObjectsInReverse()
Iterator<PersistentClass> iterateClasses()
Retrieves an iterator over the entity metadata present in this repository.
Iterator<Collection> iterateCollections()
Returns an iterator over collection metadata.
Iterator<Table> iterateTables()
Returns an iterator over table metadata.
PersistentClass locatePersistentClassByEntityName(String entityName)
Retrieves the entity mapping metadata for the given entity name, potentially accounting for imports.
void setAutoImport(boolean autoImport)
Set whether to enable auto importing of entity names.
void setCatalogName(String catalogName)
Sets the currently bound default catalog name.
void setDefaultAccess(String defaultAccess)
Sets the current default property access style.
void setDefaultCascade(String defaultCascade)
Sets the current default cascade style.
void setDefaultLazy(boolean defaultLazy)
Set whether to enable default laziness.
void setDefaultPackage(String defaultPackage)
Set the current default package name.
void setNamingStrategy(NamingStrategy namingStrategy)
Set the current naming strategy.
void setPersisterClassProvider(PersisterClassProvider persisterClassProvider)
Set the current persister class provider implementation
void setSchemaName(String schemaName)
Sets the currently bound default schema name.
boolean useNewGeneratorMappings()
Should we use the new generator strategy mappings.
Protected Methods
void removeResultSetMapping(String name)
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.hibernate.cfg.Mappings

Protected Constructors

protected Configuration.MappingsImpl ()

Public Methods

public void addAnyMetaDef (AnyMetaDef defAnn)

public void addAuxiliaryDatabaseObject (AuxiliaryDatabaseObject auxiliaryDatabaseObject)

Add metadata pertaining to an auxiliary database object to this repository.

Parameters
auxiliaryDatabaseObject The metadata.

public void addClass (PersistentClass persistentClass)

Add entity mapping metadata.

Parameters
persistentClass The entity metadata

public AnnotatedClassType addClassType (XClass clazz)

FIXME should be private but will this break things? Add a class type.

Parameters
clazz The XClass mapping.
Returns
  • The class type.

public void addCollection (Collection collection)

Add collection mapping metadata to this repository.

Parameters
collection The collection metadata

public void addColumnBinding (String logicalName, Column physicalColumn, Table table)

Binds the given 'physicalColumn' to the give 'logicalName' within the given 'table'.

Parameters
logicalName The logical column name binding.
physicalColumn The physical column metadata.
table The table metadata.

public void addDefaultGenerator (IdGenerator generator)

Adds a default id generator.

Parameters
generator The id generator

public void addDefaultQuery (String name, NamedQueryDefinition query)

public void addDefaultResultSetMapping (ResultSetMappingDefinition definition)

public void addDefaultSQLQuery (String name, NamedSQLQueryDefinition query)

public Table addDenormalizedTable (String schema, String catalog, String name, boolean isAbstract, String subselect, Table includedTable)

Adds a 'denormalized table' to this repository.

Parameters
schema The named schema in which the table belongs (or null).
catalog The named catalog in which the table belongs (or null).
name The table name
isAbstract Is the table abstract (i.e. not really existing in the DB)?
subselect A select statement which defines a logical table, much like a DB view.
includedTable ???
Returns
  • The created table metadata.

public void addFilterDefinition (FilterDefinition definition)

Adds a filter definition to this repository.

Parameters
definition The filter definition to add.

public void addGenerator (IdGenerator generator)

Add a generator.

Parameters
generator The generator to add.

public void addGeneratorTable (String name, Properties params)

Add a generator table properties.

Parameters
name The generator name
params The generator table properties.

public void addImport (String entityName, String rename)

Adds an import (HQL entity rename) to the repository.

Parameters
entityName The entity name being renamed.
rename The rename

public void addJoins (PersistentClass persistentClass, Map<StringJoin> joins)

Add join metadata for a persistent entity.

Parameters
persistentClass The persistent entity metadata.
joins The join metadata to add.

public void addMappedBy (String entityName, String propertyName, String inversePropertyName)

public void addMappedSuperclass (Class type, MappedSuperclass mappedSuperclass)

add a new MappedSuperclass This should not be called if the MappedSuperclass already exists (it would be erased)

Parameters
type type corresponding to the Mappedsuperclass
mappedSuperclass MappedSuperclass

public void addPropertyAnnotatedWithMapsId (XClass entityType, PropertyData property)

public void addPropertyAnnotatedWithMapsIdSpecj (XClass entityType, PropertyData property, String mapsIdValue)

public void addPropertyReference (String referencedClass, String propertyName)

Adds a property reference binding to this repository.

Parameters
referencedClass The referenced entity name.
propertyName The referenced property name.

public void addPropertyReferencedAssociation (String entityName, String propertyName, String propertyRef)

public void addQuery (String name, NamedQueryDefinition query)

Adds metadata for a named query to this repository.

Parameters
name The name
query The metadata

public void addResultSetMapping (ResultSetMappingDefinition sqlResultSetMapping)

Adds the metadata for a named SQL result set mapping to this repository.

Parameters
sqlResultSetMapping The metadata

public void addSQLQuery (String name, NamedSQLQueryDefinition query)

Adds metadata for a named SQL query to this repository.

Parameters
name The name
query The metadata

public void addSecondPass (SecondPass sp)

Adds a second-pass to the end of the current queue.

Parameters
sp The second pass to add.

public void addSecondPass (SecondPass sp, boolean onTopOfTheQueue)

Adds a second pass.

Parameters
sp The second pass to add.
onTopOfTheQueue True to add to the beginning of the queue; false to add to the end.

public Table addTable (String schema, String catalog, String name, String subselect, boolean isAbstract)

Adds table metadata to this repository returning the created metadata instance.

Parameters
schema The named schema in which the table belongs (or null).
catalog The named catalog in which the table belongs (or null).
name The table name
subselect A select statement which defines a logical table, much like a DB view.
isAbstract Is the table abstract (i.e. not really existing in the DB)?
Returns
  • The created table metadata, or the existing reference.

public void addTableBinding (String schema, String catalog, String logicalName, String physicalName, Table denormalizedSuperTable)

Adds a table binding to this repository.

Parameters
schema The schema in which the table belongs (may be null).
catalog The catalog in which the table belongs (may be null).
logicalName The logical table name.
physicalName The physical table name.
denormalizedSuperTable ???

public void addToExtendsQueue (ExtendsQueueEntry entry)

Adds an entry to the extends queue queue.

Parameters
entry The entry to add.

public void addToOneAndIdProperty (XClass entityType, PropertyData property)

public void addTypeDef (String typeName, String typeClass, Properties paramMap)

Adds a type definition to this metadata repository.

Parameters
typeName The type name.
typeClass The class implementing the Type contract.
paramMap Map of parameters to be used to configure the type after instantiation.

public void addUniqueConstraintHolders (Table table, List<UniqueConstraintHolder> uniqueConstraintHolders)

public void addUniqueConstraints (Table table, List uniqueConstraints)

public void addUniquePropertyReference (String referencedClass, String propertyName)

Adds a property reference binding to this repository where said proeprty reference is marked as unique.

Parameters
referencedClass The referenced entity name.
propertyName The referenced property name.

public void applyResultSetMapping (ResultSetMappingDefinition sqlResultSetMapping)

public FetchProfile findOrCreateFetchProfile (String name, MetadataSource source)

Retrieves a fetch profile by either finding one currently in this repository matching the given name or by creating one (and adding it).

Parameters
name The name of the profile.
source The source from which this profile is named.
Returns
  • The fetch profile metadata.

public AnyMetaDef getAnyMetaDef (String name)

public String getCatalogName ()

Returns the currently bound default catalog name.

Returns
  • The currently bound catalog name, or null if none.

public PersistentClass getClass (String entityName)

Retrieves the entity mapping metadata for the given entity name.

Parameters
entityName The entity name for which to retrieve the metadata.
Returns
  • The entity mapping metadata, or null if none found matching given entity name.

public AnnotatedClassType getClassType (XClass clazz)

Get and maintain a cache of class type.

Parameters
clazz The XClass mapping
Returns
  • The class type.

public Map getClasses ()

public Collection getCollection (String role)

Retrieves the collection mapping metadata for the given collection role.

Parameters
role The collection role for which to retrieve the metadata.
Returns
  • The collection mapping metadata, or null if no matching collection role found.

public Properties getConfigurationProperties ()

Retrieve the configuration properties currently in effect.

Returns
  • The configuration properties

public String getDefaultAccess ()

Get the current default property access style.

Returns
  • The current default property access style.

public String getDefaultCascade ()

Get the current default cascade style.

Returns
  • The current default cascade style.

public String getDefaultPackage ()

Get the currently bound default package name.

Returns
  • The currently bound default package name

public FilterDefinition getFilterDefinition (String name)

Retrieves a filter definition by name.

Parameters
name The name of the filter definition to retrieve.
Returns
  • The filter definition, or null.

public Map getFilterDefinitions ()

Retrieves the copmplete map of filter definitions.

Returns
  • The filter definition map.

public String getFromMappedBy (String entityName, String propertyName)

public IdGenerator getGenerator (String name)

Retrieve the id-generator by name.

Parameters
name The generator name.
Returns
  • The generator, or null.

public IdGenerator getGenerator (String name, Map<StringIdGenerator> localGenerators)

Try to find the generator from the localGenerators and then from the global generator list

Parameters
name generator name
localGenerators local generators
Returns
  • the appropriate idgenerator or null if not found

public Properties getGeneratorTableProperties (String name, Map<StringProperties> localGeneratorTables)

Retrieve the properties related to a generator table.

Parameters
name generator name
localGeneratorTables local generator tables
Returns
  • The properties, or null.

public DefaultIdentifierGeneratorFactory getIdentifierGeneratorFactory ()

Retrieve the IdentifierGeneratorFactory in effect for this mapping.

Returns
  • The IdentifierGeneratorFactory

public Map<StringJoin> getJoins (String entityName)

Retrieve join metadata for a particular persistent entity.

Parameters
entityName The entity name
Returns
  • The join metadata

public String getLogicalColumnName (String physicalName, Table table)

Find the logical column name against whcih the given physical column name was bound within the given table.

Parameters
physicalName The physical column name
table The table metadata.
Returns
  • The logical column name.

public String getLogicalTableName (Table table)

Get the logical table name mapped for the given physical table.

Parameters
table The table for which to determine the logical name.
Returns
  • The logical name.

public MappedSuperclass getMappedSuperclass (Class type)

Get a MappedSuperclass or null if not mapped

Parameters
type class corresponding to the MappedSuperclass
Returns
  • the MappedSuperclass

public NamingStrategy getNamingStrategy ()

Get the current naming strategy.

Returns
  • The current naming strategy.

public ObjectNameNormalizer getObjectNameNormalizer ()

Retrieve the database identifier normalizer for this context.

Returns
  • The normalizer.

public PersisterClassProvider getPersisterClassProvider ()

Get the current persister class provider implementation

public String getPhysicalColumnName (String logicalName, Table table)

Find the physical column name for the given logical column name within the given table.

Parameters
logicalName The logical name binding.
table The table metatdata.
Returns
  • The physical column name.

public PropertyData getPropertyAnnotatedWithIdAndToOne (XClass entityType, String propertyName)

Return the property annotated with @ToOne and @Id if any. Null otherwise

public PropertyData getPropertyAnnotatedWithMapsId (XClass entityType, String propertyName)

Return the property annotated with @MapsId("propertyName") if any. Null otherwise

public String getPropertyReferencedAssociation (String entityName, String propertyName)

public NamedQueryDefinition getQuery (String name)

Get named query metadata by name.

Parameters
name The named query name
Returns
  • The query metadata, or null.

public ReflectionManager getReflectionManager ()

public ResultSetMappingDefinition getResultSetMapping (String name)

Get the metadata for a named SQL result set mapping.

Parameters
name The mapping name.
Returns
  • The SQL result set mapping metadat, or null if none found.

public NamedSQLQueryDefinition getSQLQuery (String name)

Get named SQL query metadata.

Parameters
name The named SQL query name.
Returns
  • The meatdata, or null if none found.

public String getSchemaName ()

Returns the currently bound default schema name.

Returns
  • The currently bound schema name

public Table getTable (String schema, String catalog, String name)

Returns the named table metadata.

Parameters
schema The named schema in which the table belongs (or null).
catalog The named catalog in which the table belongs (or null).
name The table name
Returns
  • The table metadata, or null.

public Map<TableList<String[]>> getTableUniqueConstraints ()

public TypeDef getTypeDef (String typeName)

Retrieve a type definition by name.

Parameters
typeName The name of the type definition to retrieve.
Returns
  • The type definition, or null if none found.

public TypeResolver getTypeResolver ()

Retrieve the type resolver in effect.

Returns
  • The type resolver.

public Map<TableList<UniqueConstraintHolder>> getUniqueConstraintHoldersByTable ()

public boolean isAutoImport ()

Determine whether auto importing of entity names is currently enabled.

Returns
  • True if currently enabled; false otherwise.

public boolean isDefaultLazy ()

Determine whether default laziness is currently enabled.

Returns
  • True if enabled, false otherwise.

public boolean isInSecondPass ()

public boolean isSpecjProprietarySyntaxEnabled ()

public Iterator<AuxiliaryDatabaseObject> iterateAuxiliaryDatabaseObjects ()

Retrieves an iterator over the metadata pertaining to all auxiliary database objects int this repository.

Returns
  • Iterator over the auxiliary database object metadata.

public ListIterator<AuxiliaryDatabaseObject> iterateAuxiliaryDatabaseObjectsInReverse ()

Same as iterateAuxiliaryDatabaseObjects() except that here the iterator is reversed.

Returns
  • The reversed iterator.

public Iterator<AuxiliaryDatabaseObject> iterateAuxliaryDatabaseObjects ()

public ListIterator<AuxiliaryDatabaseObject> iterateAuxliaryDatabaseObjectsInReverse ()

public Iterator<PersistentClass> iterateClasses ()

Retrieves an iterator over the entity metadata present in this repository.

Returns
  • Iterator over class metadata.

public Iterator<Collection> iterateCollections ()

Returns an iterator over collection metadata.

Returns
  • Iterator over collection metadata.

public Iterator<Table> iterateTables ()

Returns an iterator over table metadata.

Returns
  • Iterator over table metadata.

public PersistentClass locatePersistentClassByEntityName (String entityName)

Retrieves the entity mapping metadata for the given entity name, potentially accounting for imports.

Parameters
entityName The entity name for which to retrieve the metadata.
Returns
  • The entity mapping metadata, or null if none found matching given entity name.

public void setAutoImport (boolean autoImport)

Set whether to enable auto importing of entity names.

Parameters
autoImport True to enable; false to diasable.

public void setCatalogName (String catalogName)

Sets the currently bound default catalog name.

Parameters
catalogName The catalog name to use as the current default.

public void setDefaultAccess (String defaultAccess)

Sets the current default property access style.

Parameters
defaultAccess The access style to use as the current default.

public void setDefaultCascade (String defaultCascade)

Sets the current default cascade style. .

Parameters
defaultCascade The cascade style to set as the current default.

public void setDefaultLazy (boolean defaultLazy)

Set whether to enable default laziness.

Parameters
defaultLazy True to enable, false to disable.

public void setDefaultPackage (String defaultPackage)

Set the current default package name.

Parameters
defaultPackage The package name to set as the current default.

public void setNamingStrategy (NamingStrategy namingStrategy)

Set the current naming strategy.

Parameters
namingStrategy The naming strategy to use.

public void setPersisterClassProvider (PersisterClassProvider persisterClassProvider)

Set the current persister class provider implementation

public void setSchemaName (String schemaName)

Sets the currently bound default schema name.

Parameters
schemaName The schema name to bind as the current default.

public boolean useNewGeneratorMappings ()

Should we use the new generator strategy mappings. This is controlled by the USE_NEW_ID_GENERATOR_MAPPINGS setting.

Returns
  • True if the new generators should be used, false otherwise.

Protected Methods

protected void removeResultSetMapping (String name)