org.hibernate.cfg

Class Mappings

Implemented Interfaces:
Serializable

public class Mappings
extends java.lang.Object
implements Serializable

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

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
addSQLQuery(String name, NamedSQLQueryDefinition query)
void
addSecondPass(SecondPass sp)
void
addSecondPass(SecondPass sp, boolean onTopOfTheQueue)
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.

Field Details

autoImport

protected boolean autoImport

auxiliaryDatabaseObjects

protected final List auxiliaryDatabaseObjects

catalogName

protected String catalogName

classes

protected final Map classes

collections

protected final Map collections

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

defaultAccess

protected String defaultAccess

defaultCascade

protected String defaultCascade

defaultLazy

protected boolean defaultLazy

defaultPackage

protected String defaultPackage

extendsQueue

protected final Map extendsQueue

filterDefinitions

protected final Map filterDefinitions

imports

protected final Map imports

namingStrategy

protected final NamingStrategy namingStrategy

propertyReferences

protected final List propertyReferences

queries

protected final Map queries

resultSetMappings

protected final Map resultSetMappings

schemaName

protected String schemaName

secondPasses

protected final List secondPasses

sqlqueries

protected final Map sqlqueries

tableNameBinding

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

tables

protected final Map tables

typeDefs

protected final Map typeDefs

Method Details

addAuxiliaryDatabaseObject

public void addAuxiliaryDatabaseObject(AuxiliaryDatabaseObject auxiliaryDatabaseObject)

addClass

public void addClass(PersistentClass persistentClass)
            throws MappingException

addCollection

public void addCollection(Collection collection)
            throws MappingException

addColumnBinding

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

addDenormalizedTable

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

addFilterDefinition

public void addFilterDefinition(FilterDefinition definition)

addImport

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

addQuery

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

addResultSetMapping

public void addResultSetMapping(ResultSetMappingDefinition sqlResultSetMapping)

addSQLQuery

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

addSecondPass

public void addSecondPass(SecondPass sp)

addSecondPass

public void addSecondPass(SecondPass sp,
                          boolean onTopOfTheQueue)

addTable

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

addTableBinding

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

addToExtendsQueue

public void addToExtendsQueue(ExtendsQueueEntry entry)

addTypeDef

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

getCatalogName

public String getCatalogName()

getClass

public PersistentClass getClass(String className)

getCollection

public Collection getCollection(String role)

getDefaultAccess

public String getDefaultAccess()

getDefaultCascade

public String getDefaultCascade()

getDefaultPackage

public String getDefaultPackage()
Returns:
Returns the defaultPackage.

getFilterDefinition

public FilterDefinition getFilterDefinition(String name)

getFilterDefinitions

public Map getFilterDefinitions()

getLogicalColumnName

public String getLogicalColumnName(String physicalName,
                                   Table table)

getLogicalTableName

public String getLogicalTableName(Table table)

getNamingStrategy

public NamingStrategy getNamingStrategy()

getPhysicalColumnName

public String getPhysicalColumnName(String logicalName,
                                    Table table)

getQuery

public NamedQueryDefinition getQuery(String name)

getResultSetMapping

public ResultSetMappingDefinition getResultSetMapping(String name)

getSchemaName

public String getSchemaName()

getTable

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

getTypeDef

public TypeDef getTypeDef(String typeName)

isAutoImport

public boolean isAutoImport()
Returns the autoImport.
Returns:
boolean

isDefaultLazy

public boolean isDefaultLazy()

iterateCollections

public Iterator iterateCollections()

iterateTables

public Iterator iterateTables()

locatePersistentClassByEntityName

public PersistentClass locatePersistentClassByEntityName(String entityName)

setAutoImport

public void setAutoImport(boolean autoImport)
Sets the autoImport.
Parameters:
autoImport - The autoImport to set

setCatalogName

public void setCatalogName(String catalogName)
Sets the catalogName.
Parameters:
catalogName - The catalogName to set

setDefaultAccess

public void setDefaultAccess(String defaultAccess)
sets the default access strategy
Parameters:
defaultAccess - the default access strategy.

setDefaultCascade

public void setDefaultCascade(String defaultCascade)
Sets the defaultCascade.
Parameters:
defaultCascade - The defaultCascade to set

setDefaultLazy

public void setDefaultLazy(boolean defaultLazy)

setDefaultPackage

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

setSchemaName

public void setSchemaName(String schemaName)
Sets the schemaName.
Parameters:
schemaName - The schemaName to set