org.hibernate.cfg
Class Mappings

java.lang.Object
  extended by org.hibernate.cfg.Mappings
All Implemented Interfaces:
Serializable

public class Mappings
extends Object
implements Serializable

A collection of mappings from classes and collections to relational database tables. (Represents a single <hibernate-mapping> element.)

Author:
Gavin King
See Also:
Serialized Form

Nested Class Summary
static class Mappings.ColumnNames
           
static class Mappings.TableDescription
           
 
Field Summary
protected  boolean autoImport
           
protected  List auxiliaryDatabaseObjects
           
protected  String catalogName
           
protected  Map classes
           
protected  Map collections
           
protected  Map columnNameBindingPerTable
          binding table between the logical column name and the name out of the naming strategy for each table.
protected  String defaultAccess
           
protected  String defaultCascade
           
protected  boolean defaultLazy
           
protected  String defaultPackage
           
protected  Map extendsQueue
           
protected  Map filterDefinitions
           
protected  Map imports
           
protected  NamingStrategy namingStrategy
           
protected  List propertyReferences
           
protected  Map queries
           
protected  Map resultSetMappings
           
protected  String schemaName
           
protected  List secondPasses
           
protected  Map sqlqueries
           
protected  Map tableNameBinding
          binding between logical table name and physical one (ie after the naming strategy has been applied)
protected  Map tables
           
protected  Map typeDefs
           
 
Method Summary
 void addAuxiliaryDatabaseObject(AuxiliaryDatabaseObject auxiliaryDatabaseObject)
           
 void addClass(PersistentClass persistentClass)
           
 void addCollection(Collection collection)
           
 void addColumnBinding(String logicalName, Column finalColumn, Table table)
           
 Table addDenormalizedTable(String schema, String catalog, String name, boolean isAbstract, String subselect, Table includedTable)
           
 void addFilterDefinition(FilterDefinition definition)
           
 void addImport(String className, String rename)
           
 void addQuery(String name, NamedQueryDefinition query)
           
 void addResultSetMapping(ResultSetMappingDefinition sqlResultSetMapping)
           
 void addSecondPass(SecondPass sp)
           
 void addSecondPass(SecondPass sp, boolean onTopOfTheQueue)
           
 void addSQLQuery(String name, NamedSQLQueryDefinition query)
           
 Table addTable(String schema, String catalog, String name, String subselect, boolean isAbstract)
           
 void addTableBinding(String schema, String catalog, String logicalName, String physicalName, Table denormalizedSuperTable)
           
 void addToExtendsQueue(ExtendsQueueEntry entry)
           
 void addTypeDef(String typeName, String typeClass, Properties paramMap)
           
 String getCatalogName()
           
 PersistentClass getClass(String className)
           
 Collection getCollection(String role)
           
 String getDefaultAccess()
           
 String getDefaultCascade()
           
 String getDefaultPackage()
           
 FilterDefinition getFilterDefinition(String name)
           
 Map getFilterDefinitions()
           
 String getLogicalColumnName(String physicalName, Table table)
           
 String getLogicalTableName(Table table)
           
 NamingStrategy getNamingStrategy()
           
 String getPhysicalColumnName(String logicalName, Table table)
           
 NamedQueryDefinition getQuery(String name)
           
 ResultSetMappingDefinition getResultSetMapping(String name)
           
 String getSchemaName()
           
 Table getTable(String schema, String catalog, String name)
           
 TypeDef getTypeDef(String typeName)
           
 boolean isAutoImport()
          Returns the autoImport.
 boolean isDefaultLazy()
           
 Iterator iterateCollections()
           
 Iterator iterateTables()
           
 PersistentClass locatePersistentClassByEntityName(String entityName)
           
 void setAutoImport(boolean autoImport)
          Sets the autoImport.
 void setCatalogName(String catalogName)
          Sets the catalogName.
 void setDefaultAccess(String defaultAccess)
          sets the default access strategy
 void setDefaultCascade(String defaultCascade)
          Sets the defaultCascade.
 void setDefaultLazy(boolean defaultLazy)
           
 void setDefaultPackage(String defaultPackage)
           
 void setSchemaName(String schemaName)
          Sets the schemaName.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classes

protected final Map classes

collections

protected final Map collections

tables

protected final Map tables

queries

protected final Map queries

sqlqueries

protected final Map sqlqueries

resultSetMappings

protected final Map resultSetMappings

typeDefs

protected final Map typeDefs

secondPasses

protected final List secondPasses

imports

protected final Map imports

schemaName

protected String schemaName

catalogName

protected String catalogName

defaultCascade

protected String defaultCascade

defaultPackage

protected String defaultPackage

defaultAccess

protected String defaultAccess

autoImport

protected boolean autoImport

defaultLazy

protected boolean defaultLazy

propertyReferences

protected final List propertyReferences

namingStrategy

protected final NamingStrategy namingStrategy

filterDefinitions

protected final Map filterDefinitions

auxiliaryDatabaseObjects

protected final List auxiliaryDatabaseObjects

extendsQueue

protected final Map extendsQueue

columnNameBindingPerTable

protected final Map columnNameBindingPerTable
binding table between the logical column name and the name out of the naming strategy for each table. According that when the column name is not set, the property name is considered as such This means that while theorically possible through the naming strategy contract, it is forbidden to have 2 real columns having the same logical name


tableNameBinding

protected final Map tableNameBinding
binding between logical table name and physical one (ie after the naming strategy has been applied)

Method Detail

addClass

public void addClass(PersistentClass persistentClass)
              throws MappingException
Throws:
MappingException

addCollection

public void addCollection(Collection collection)
                   throws MappingException
Throws:
MappingException

getClass

public PersistentClass getClass(String className)

getCollection

public Collection getCollection(String role)

addImport

public void addImport(String className,
                      String rename)
               throws MappingException
Throws:
MappingException

addTable

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

addDenormalizedTable

public Table addDenormalizedTable(String schema,
                                  String catalog,
                                  String name,
                                  boolean isAbstract,
                                  String subselect,
                                  Table includedTable)
                           throws MappingException
Throws:
MappingException

getTable

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

getSchemaName

public String getSchemaName()

getCatalogName

public String getCatalogName()

getDefaultCascade

public String getDefaultCascade()

setSchemaName

public void setSchemaName(String schemaName)
Sets the schemaName.

Parameters:
schemaName - The schemaName to set

setCatalogName

public void setCatalogName(String catalogName)
Sets the catalogName.

Parameters:
catalogName - The catalogName to set

setDefaultCascade

public void setDefaultCascade(String defaultCascade)
Sets the defaultCascade.

Parameters:
defaultCascade - The defaultCascade to set

setDefaultAccess

public void setDefaultAccess(String defaultAccess)
sets the default access strategy

Parameters:
defaultAccess - the default access strategy.

getDefaultAccess

public String getDefaultAccess()

addQuery

public void addQuery(String name,
                     NamedQueryDefinition query)
              throws MappingException
Throws:
MappingException

addSQLQuery

public void addSQLQuery(String name,
                        NamedSQLQueryDefinition query)
                 throws MappingException
Throws:
MappingException

addResultSetMapping

public void addResultSetMapping(ResultSetMappingDefinition sqlResultSetMapping)

getResultSetMapping

public ResultSetMappingDefinition getResultSetMapping(String name)

getQuery

public NamedQueryDefinition getQuery(String name)

addSecondPass

public void addSecondPass(SecondPass sp)

addSecondPass

public void addSecondPass(SecondPass sp,
                          boolean onTopOfTheQueue)

isAutoImport

public boolean isAutoImport()
Returns the autoImport.

Returns:
boolean

setAutoImport

public void setAutoImport(boolean autoImport)
Sets the autoImport.

Parameters:
autoImport - The autoImport to set

getDefaultPackage

public String getDefaultPackage()
Returns:
Returns the defaultPackage.

setDefaultPackage

public void setDefaultPackage(String defaultPackage)
Parameters:
defaultPackage - The defaultPackage to set.

getNamingStrategy

public NamingStrategy getNamingStrategy()

addTypeDef

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

getTypeDef

public TypeDef getTypeDef(String typeName)

iterateCollections

public Iterator iterateCollections()

iterateTables

public Iterator iterateTables()

getFilterDefinitions

public Map getFilterDefinitions()

addFilterDefinition

public void addFilterDefinition(FilterDefinition definition)

getFilterDefinition

public FilterDefinition getFilterDefinition(String name)

isDefaultLazy

public boolean isDefaultLazy()

setDefaultLazy

public void setDefaultLazy(boolean defaultLazy)

addToExtendsQueue

public void addToExtendsQueue(ExtendsQueueEntry entry)

locatePersistentClassByEntityName

public PersistentClass locatePersistentClassByEntityName(String entityName)

addAuxiliaryDatabaseObject

public void addAuxiliaryDatabaseObject(AuxiliaryDatabaseObject auxiliaryDatabaseObject)

addTableBinding

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

addColumnBinding

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

getPhysicalColumnName

public String getPhysicalColumnName(String logicalName,
                                    Table table)

getLogicalColumnName

public String getLogicalColumnName(String physicalName,
                                   Table table)

getLogicalTableName

public String getLogicalTableName(Table table)