org.hibernate.cfg
Class AnnotationConfiguration.ExtendedMappingsImpl

java.lang.Object
  extended by org.hibernate.cfg.Configuration.MappingsImpl
      extended by org.hibernate.cfg.AnnotationConfiguration.ExtendedMappingsImpl
All Implemented Interfaces:
Serializable, ExtendedMappings, Mappings
Enclosing class:
AnnotationConfiguration

protected class AnnotationConfiguration.ExtendedMappingsImpl
extends Configuration.MappingsImpl
implements ExtendedMappings

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.hibernate.cfg.Mappings
Mappings.PropertyReference
 
Constructor Summary
AnnotationConfiguration.ExtendedMappingsImpl()
           
 
Method Summary
 void addAnnotationConfiguredFetchProfile(FetchProfile fetchProfile)
          Add the specified profile to the list of fetch profiles configured via annotations.
 void addAnyMetaDef(AnyMetaDef defAnn)
           
 AnnotatedClassType addClassType(org.hibernate.annotations.common.reflection.XClass clazz)
          FIXME should be private but will this break things? Add a class type.
 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)
           
 void addGenerator(IdGenerator generator)
          Add a generator.
 void addGeneratorTable(String name, Properties params)
          Add a generator table properties.
 void addJoins(PersistentClass persistentClass, Map<String,Join> joins)
          Add join metadata for a persistent entity.
 void addMappedBy(String entityName, String propertyName, String inversePropertyName)
           
 void addPropertyAnnotatedWithMapsId(org.hibernate.annotations.common.reflection.XClass entityType, PropertyData property)
           
 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 definition)
          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 addToOneAndIdProperty(org.hibernate.annotations.common.reflection.XClass entityType, PropertyData property)
           
 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.
 boolean containsAnnotationConfiguredFetchProfile(FetchProfile fetchProfile)
           
 AnyMetaDef getAnyMetaDef(String name)
           
 Map getClasses()
           
 AnnotatedClassType getClassType(org.hibernate.annotations.common.reflection.XClass clazz)
          Get and maintain a cache of class type.
 String getFromMappedBy(String entityName, String propertyName)
           
 IdGenerator getGenerator(String name)
          Retrieve the id-generator by name.
 IdGenerator getGenerator(String name, Map<String,IdGenerator> localGenerators)
          Try to find the generator from the localGenerators and then from the global generator list
 Properties getGeneratorTableProperties(String name, Map<String,Properties> localGeneratorTables)
          Retrieve the properties related to a generator table.
 Map<String,Join> getJoins(String entityName)
          Retrieve join metadata for a particular persistent entity.
 PropertyData getPropertyAnnotatedWithIdAndToOne(org.hibernate.annotations.common.reflection.XClass entityType, String propertyName)
          Return the property annotated with @ToOne and @Id if any.
 PropertyData getPropertyAnnotatedWithMapsId(org.hibernate.annotations.common.reflection.XClass entityType, String propertyName)
          Return the property annotated with @MapsId("propertyName") if any.
 String getPropertyReferencedAssociation(String entityName, String propertyName)
           
 org.hibernate.annotations.common.reflection.ReflectionManager getReflectionManager()
           
 Map<Table,List<String[]>> getTableUniqueConstraints()
          
 Map<Table,List<UniqueConstraintHolder>> getUniqueConstraintHoldersByTable()
           
 boolean isInSecondPass()
           
 boolean useNewGeneratorMappings()
          Should we use the new generator strategy mappings.
 
Methods inherited from class org.hibernate.cfg.Configuration.MappingsImpl
addAuxiliaryDatabaseObject, addClass, addCollection, addColumnBinding, addDenormalizedTable, addFilterDefinition, addImport, addMappedSuperclass, addSecondPass, addSecondPass, addTable, addTableBinding, addToExtendsQueue, addTypeDef, findOrCreateFetchProfile, getCatalogName, getClass, getCollection, getConfigurationProperties, getDefaultAccess, getDefaultCascade, getDefaultPackage, getFilterDefinition, getFilterDefinitions, getIdentifierGeneratorFactory, getLogicalColumnName, getLogicalTableName, getMappedSuperclass, getNamingStrategy, getObjectNameNormalizer, getPhysicalColumnName, getQuery, getResultSetMapping, getSchemaName, getSQLQuery, getTable, getTypeDef, isAutoImport, isDefaultLazy, iterateAuxliaryDatabaseObjects, iterateAuxliaryDatabaseObjectsInReverse, iterateClasses, iterateCollections, iterateTables, locatePersistentClassByEntityName, removeResultSetMapping, setAutoImport, setCatalogName, setDefaultAccess, setDefaultCascade, setDefaultLazy, setDefaultPackage, setNamingStrategy, setSchemaName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.hibernate.cfg.Mappings
addAuxiliaryDatabaseObject, addClass, addCollection, addColumnBinding, addDenormalizedTable, addFilterDefinition, addImport, addMappedSuperclass, addSecondPass, addSecondPass, addTable, addTableBinding, addToExtendsQueue, addTypeDef, findOrCreateFetchProfile, getCatalogName, getClass, getCollection, getConfigurationProperties, getDefaultAccess, getDefaultCascade, getDefaultPackage, getFilterDefinition, getFilterDefinitions, getIdentifierGeneratorFactory, getLogicalColumnName, getLogicalTableName, getMappedSuperclass, getNamingStrategy, getObjectNameNormalizer, getPhysicalColumnName, getQuery, getResultSetMapping, getSchemaName, getSQLQuery, getTable, getTypeDef, isAutoImport, isDefaultLazy, iterateAuxliaryDatabaseObjects, iterateAuxliaryDatabaseObjectsInReverse, iterateClasses, iterateCollections, iterateTables, locatePersistentClassByEntityName, setAutoImport, setCatalogName, setDefaultAccess, setDefaultCascade, setDefaultLazy, setDefaultPackage, setNamingStrategy, setSchemaName
 

Constructor Detail

AnnotationConfiguration.ExtendedMappingsImpl

public AnnotationConfiguration.ExtendedMappingsImpl()
Method Detail

addDefaultGenerator

public void addDefaultGenerator(IdGenerator generator)
Description copied from interface: ExtendedMappings
Adds a default id generator.

Specified by:
addDefaultGenerator in interface ExtendedMappings
Parameters:
generator - The id generator

isInSecondPass

public boolean isInSecondPass()
Specified by:
isInSecondPass in interface ExtendedMappings

getPropertyAnnotatedWithMapsId

public PropertyData getPropertyAnnotatedWithMapsId(org.hibernate.annotations.common.reflection.XClass entityType,
                                                   String propertyName)
Description copied from interface: ExtendedMappings
Return the property annotated with @MapsId("propertyName") if any. Null otherwise

Specified by:
getPropertyAnnotatedWithMapsId in interface ExtendedMappings

addPropertyAnnotatedWithMapsId

public void addPropertyAnnotatedWithMapsId(org.hibernate.annotations.common.reflection.XClass entityType,
                                           PropertyData property)
Specified by:
addPropertyAnnotatedWithMapsId in interface ExtendedMappings

getPropertyAnnotatedWithIdAndToOne

public PropertyData getPropertyAnnotatedWithIdAndToOne(org.hibernate.annotations.common.reflection.XClass entityType,
                                                       String propertyName)
Description copied from interface: ExtendedMappings
Return the property annotated with @ToOne and @Id if any. Null otherwise

Specified by:
getPropertyAnnotatedWithIdAndToOne in interface ExtendedMappings

addToOneAndIdProperty

public void addToOneAndIdProperty(org.hibernate.annotations.common.reflection.XClass entityType,
                                  PropertyData property)
Specified by:
addToOneAndIdProperty in interface ExtendedMappings

useNewGeneratorMappings

public boolean useNewGeneratorMappings()
Description copied from interface: ExtendedMappings
Should we use the new generator strategy mappings. This is controlled by the AnnotationConfiguration.USE_NEW_ID_GENERATOR_MAPPINGS setting.

Specified by:
useNewGeneratorMappings in interface ExtendedMappings
Returns:
True if the new generators should be used, false otherwise.

getGenerator

public IdGenerator getGenerator(String name)
Description copied from interface: ExtendedMappings
Retrieve the id-generator by name.

Specified by:
getGenerator in interface ExtendedMappings
Parameters:
name - The generator name.
Returns:
The generator, or null.

getGenerator

public IdGenerator getGenerator(String name,
                                Map<String,IdGenerator> localGenerators)
Description copied from interface: ExtendedMappings
Try to find the generator from the localGenerators and then from the global generator list

Specified by:
getGenerator in interface ExtendedMappings
Parameters:
name - generator name
localGenerators - local generators
Returns:
the appropriate idgenerator or null if not found

addGenerator

public void addGenerator(IdGenerator generator)
Description copied from interface: ExtendedMappings
Add a generator.

Specified by:
addGenerator in interface ExtendedMappings
Parameters:
generator - The generator to add.

addGeneratorTable

public void addGeneratorTable(String name,
                              Properties params)
Description copied from interface: ExtendedMappings
Add a generator table properties.

Specified by:
addGeneratorTable in interface ExtendedMappings
Parameters:
name - The generator name
params - The generator table properties.

getGeneratorTableProperties

public Properties getGeneratorTableProperties(String name,
                                              Map<String,Properties> localGeneratorTables)
Description copied from interface: ExtendedMappings
Retrieve the properties related to a generator table.

Specified by:
getGeneratorTableProperties in interface ExtendedMappings
Parameters:
name - generator name
localGeneratorTables - local generator tables
Returns:
The properties, or null.

getJoins

public Map<String,Join> getJoins(String entityName)
Description copied from interface: ExtendedMappings
Retrieve join metadata for a particular persistent entity.

Specified by:
getJoins in interface ExtendedMappings
Parameters:
entityName - The entity name
Returns:
The join metadata

addJoins

public void addJoins(PersistentClass persistentClass,
                     Map<String,Join> joins)
Description copied from interface: ExtendedMappings
Add join metadata for a persistent entity.

Specified by:
addJoins in interface ExtendedMappings
Parameters:
persistentClass - The persistent entity metadata.
joins - The join metadata to add.

getClassType

public AnnotatedClassType getClassType(org.hibernate.annotations.common.reflection.XClass clazz)
Description copied from interface: ExtendedMappings
Get and maintain a cache of class type.

Specified by:
getClassType in interface ExtendedMappings
Parameters:
clazz - The XClass mapping
Returns:
The class type.

addClassType

public AnnotatedClassType addClassType(org.hibernate.annotations.common.reflection.XClass clazz)
Description copied from interface: ExtendedMappings
FIXME should be private but will this break things? Add a class type.

Specified by:
addClassType in interface ExtendedMappings
Parameters:
clazz - The XClass mapping.
Returns:
The class type.

getTableUniqueConstraints

public Map<Table,List<String[]>> getTableUniqueConstraints()

Specified by:
getTableUniqueConstraints in interface ExtendedMappings

getUniqueConstraintHoldersByTable

public Map<Table,List<UniqueConstraintHolder>> getUniqueConstraintHoldersByTable()
Specified by:
getUniqueConstraintHoldersByTable in interface ExtendedMappings

addUniqueConstraints

public void addUniqueConstraints(Table table,
                                 List uniqueConstraints)
Specified by:
addUniqueConstraints in interface ExtendedMappings

addUniqueConstraintHolders

public void addUniqueConstraintHolders(Table table,
                                       List<UniqueConstraintHolder> uniqueConstraintHolders)
Specified by:
addUniqueConstraintHolders in interface ExtendedMappings

addMappedBy

public void addMappedBy(String entityName,
                        String propertyName,
                        String inversePropertyName)
Specified by:
addMappedBy in interface ExtendedMappings

getFromMappedBy

public String getFromMappedBy(String entityName,
                              String propertyName)
Specified by:
getFromMappedBy in interface ExtendedMappings

addPropertyReferencedAssociation

public void addPropertyReferencedAssociation(String entityName,
                                             String propertyName,
                                             String propertyRef)
Specified by:
addPropertyReferencedAssociation in interface ExtendedMappings

getPropertyReferencedAssociation

public String getPropertyReferencedAssociation(String entityName,
                                               String propertyName)
Specified by:
getPropertyReferencedAssociation in interface ExtendedMappings

addUniquePropertyReference

public void addUniquePropertyReference(String referencedClass,
                                       String propertyName)
Description copied from interface: Mappings
Adds a property reference binding to this repository where said proeprty reference is marked as unique.

Specified by:
addUniquePropertyReference in interface Mappings
Overrides:
addUniquePropertyReference in class Configuration.MappingsImpl
Parameters:
referencedClass - The referenced entity name.
propertyName - The referenced property name.

addPropertyReference

public void addPropertyReference(String referencedClass,
                                 String propertyName)
Description copied from interface: Mappings
Adds a property reference binding to this repository.

Specified by:
addPropertyReference in interface Mappings
Overrides:
addPropertyReference in class Configuration.MappingsImpl
Parameters:
referencedClass - The referenced entity name.
propertyName - The referenced property name.

getReflectionManager

public org.hibernate.annotations.common.reflection.ReflectionManager getReflectionManager()
Specified by:
getReflectionManager in interface ExtendedMappings

addDefaultQuery

public void addDefaultQuery(String name,
                            NamedQueryDefinition query)
Specified by:
addDefaultQuery in interface ExtendedMappings

addDefaultSQLQuery

public void addDefaultSQLQuery(String name,
                               NamedSQLQueryDefinition query)
Specified by:
addDefaultSQLQuery in interface ExtendedMappings

addDefaultResultSetMapping

public void addDefaultResultSetMapping(ResultSetMappingDefinition definition)
Specified by:
addDefaultResultSetMapping in interface ExtendedMappings

addQuery

public void addQuery(String name,
                     NamedQueryDefinition query)
              throws DuplicateMappingException
Description copied from interface: Mappings
Adds metadata for a named query to this repository.

Specified by:
addQuery in interface Mappings
Overrides:
addQuery in class Configuration.MappingsImpl
Parameters:
name - The name
query - The metadata
Throws:
DuplicateMappingException - If a query already exists with that name.

addResultSetMapping

public void addResultSetMapping(ResultSetMappingDefinition definition)
                         throws DuplicateMappingException
Description copied from interface: Mappings
Adds the metadata for a named SQL result set mapping to this repository.

Specified by:
addResultSetMapping in interface Mappings
Overrides:
addResultSetMapping in class Configuration.MappingsImpl
Parameters:
definition - The metadata
Throws:
DuplicateMappingException - If metadata for another SQL result mapping was already found under the given name.

addSQLQuery

public void addSQLQuery(String name,
                        NamedSQLQueryDefinition query)
                 throws DuplicateMappingException
Description copied from interface: Mappings
Adds metadata for a named SQL query to this repository.

Specified by:
addSQLQuery in interface Mappings
Overrides:
addSQLQuery in class Configuration.MappingsImpl
Parameters:
name - The name
query - The metadata
Throws:
DuplicateMappingException - If a query already exists with that name.

getClasses

public Map getClasses()
Specified by:
getClasses in interface ExtendedMappings

addAnyMetaDef

public void addAnyMetaDef(AnyMetaDef defAnn)
                   throws AnnotationException
Specified by:
addAnyMetaDef in interface ExtendedMappings
Throws:
AnnotationException

getAnyMetaDef

public AnyMetaDef getAnyMetaDef(String name)
Specified by:
getAnyMetaDef in interface ExtendedMappings

addAnnotationConfiguredFetchProfile

public void addAnnotationConfiguredFetchProfile(FetchProfile fetchProfile)
Description copied from interface: ExtendedMappings
Add the specified profile to the list of fetch profiles configured via annotations.

Specified by:
addAnnotationConfiguredFetchProfile in interface ExtendedMappings
Parameters:
fetchProfile - the fetch profile

containsAnnotationConfiguredFetchProfile

public boolean containsAnnotationConfiguredFetchProfile(FetchProfile fetchProfile)
Specified by:
containsAnnotationConfiguredFetchProfile in interface ExtendedMappings
Returns:
if the provided fetch profile has been configured via xml, .


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.