org.hibernate.persister.entity
Class UnionSubclassEntityPersister

java.lang.Object
  extended byorg.hibernate.persister.entity.BasicEntityPersister
      extended byorg.hibernate.persister.entity.UnionSubclassEntityPersister
All Implemented Interfaces:
ClassMetadata, EntityPersister, Joinable, LazyPropertyInitializer, Loadable, OuterJoinLoadable, PostInsertIdentityPersister, PropertyMapping, Queryable, SQLLoadable, UniqueKeyLoadable

public class UnionSubclassEntityPersister
extends BasicEntityPersister

Implementation of the "table-per-concrete-class" or "roll-down" mapping strategy for an entity and its inheritence hierarchy.

Author:
Gavin King

Field Summary
 
Fields inherited from class org.hibernate.persister.entity.BasicEntityPersister
customSQLDelete, customSQLInsert, customSQLUpdate, deleteCallable, ENTITY_CLASS, insertCallable, propertyMapping, rowIdName, updateCallable
 
Fields inherited from interface org.hibernate.persister.entity.Loadable
ROWID_ALIAS
 
Fields inherited from interface org.hibernate.persister.entity.EntityPersister
ENTITY_ID
 
Fields inherited from interface org.hibernate.intercept.LazyPropertyInitializer
UNFETCHED_PROPERTY
 
Constructor Summary
UnionSubclassEntityPersister(PersistentClass persistentClass, CacheConcurrencyStrategy cache, SessionFactoryImplementor factory, Mapping mapping)
           
 
Method Summary
protected  void addDiscriminatorToSelect(SelectFragment select, String name, String suffix)
           
 String filterFragment(String name)
           
 String fromTableFragment(String name)
          Get the main from table fragment, given a query alias.
protected  String generateSelectString(LockMode lockMode)
          Generate the SQL that selects a row by id
protected  String generateSubquery(PersistentClass model, Mapping mapping)
           
protected  String getDiscriminatorFormula()
           
 String getDiscriminatorSQLValue()
          Get the discriminator value for this particular concrete subclass, as a string that may be embedded in a select statement
 Type getDiscriminatorType()
          Get the discriminator type
protected  String[] getKeyColumns(int j)
           
 Serializable[] getPropertySpaces()
          Returns an array of objects that identify spaces in which properties of this class are persisted, for instances of this class only.
 String getPropertyTableName(String propertyName)
          Get the table name for the given property path
protected  int[] getPropertyTableNumbers()
           
protected  int[] getPropertyTableNumbersInSelect()
           
 Serializable[] getQuerySpaces()
          Returns an array of objects that identify spaces in which properties of this class are persisted, for instances of this class and its subclasses.
 String[] getSubclassClosure()
           
protected  int[] getSubclassColumnTableNumberClosure()
           
 String getSubclassForDiscriminatorValue(Object value)
          Get the concrete subclass corresponding to the given discriminator value
protected  int[] getSubclassFormulaTableNumberClosure()
           
 String getSubclassPropertyTableName(int i)
          Return the table name used to persist the numbered property of the class or a subclass.
protected  int getSubclassPropertyTableNumber(int i)
           
protected  int getSubclassPropertyTableNumber(String propertyName)
          Warning: When there are duplicated property names in the subclasses of the class, this method may return the wrong table number for the duplicated subclass property (note that SingleTableEntityPersister defines an overloaded form which takes the entity name.
protected  String[] getSubclassTableKeyColumns(int j)
           
protected  String getSubclassTableName(int j)
           
protected  int getSubclassTableSpan()
           
protected  boolean[] getTableHasColumns()
           
 String getTableName()
          The table to join to.
protected  String getTableName(int j)
           
protected  int getTableSpan()
           
protected  boolean isClassOrSuperclassTable(int j)
           
protected  boolean isDiscriminatorFormula()
           
protected  boolean isPropertyOfTable(int property, int j)
           
protected  boolean isTableCascadeDeleteEnabled(int j)
           
 
Methods inherited from class org.hibernate.persister.entity.BasicEntityPersister
addDiscriminatorToInsert, afterInitialize, afterReassociate, check, concretePropertySelectFragment, consumesCollectionAlias, consumesEntityAlias, countSubclassProperties, createEntityLoader, createEntityLoader, createFrom, createJoin, createJoin, createProxy, createQueryLoader, createSelect, createUniqueKeyLoaders, createWhereByKey, dehydrate, dehydrate, delete, delete, filterFragment, findDirty, findModified, fromJoinFragment, generateDeleteString, generateFilterConditionAlias, generateInsertString, generateInsertString, generateInsertString, generateLazySelectString, generateLockString, generateSelectVersionString, generateSnapshotSelectString, generateTableAlias, generateUpdateString, generateUpdateString, getCache, getCacheEntryStructure, getClassMetadata, getConcreteProxyClass, getCurrentVersion, getDatabaseSnapshot, getDiscriminatorAlias, getDiscriminatorAlias, getDiscriminatorColumnName, getDiscriminatorFormulaTemplate, getEntityMetamodel, getEntityName, getEntityType, getFactory, getFetchMode, getIdentifier, getIdentifierAliases, getIdentifierAliases, getIdentifierColumnNames, getIdentifierColumnSpan, getIdentifierGenerator, getIdentifierPropertyName, getIdentifierType, getIdentitySelectString, getKeyColumnNames, getLazyProperties, getMappedClass, getMappedSuperclass, getName, getNonLazyPropertyUpdateability, getPropertiesToInsert, getPropertiesToUpdate, getPropertyAliases, getPropertyCascadeStyles, getPropertyCheckability, getPropertyColumnNames, getPropertyColumnNames, getPropertyColumnSpan, getPropertyIndex, getPropertyIndexOrNull, getPropertyInsertability, getPropertyLaziness, getPropertyNames, getPropertyNullability, getPropertySpan, getPropertySubclassNames, getPropertyType, getPropertyTypes, getPropertyUpdateability, getPropertyUpdateability, getPropertyValue, getPropertyValue, getPropertyValues, getPropertyValuesToInsert, getPropertyVersionability, getRootEntityName, getRootTableKeyColumnNames, getSelectByUniqueKeyString, getSequentialSelect, getSQLDeleteStrings, getSQLIdentityInsertString, getSQLInsertStrings, getSQLLazySelectString, getSQLLazyUpdateByRowIdStrings, getSQLLazyUpdateStrings, getSQLSnapshotSelectString, getSQLUpdateByRowIdStrings, getSQLUpdateStrings, getSQLWhereString, getSubclassColumnAliasClosure, getSubclassColumnClosure, getSubclassColumnLazyiness, getSubclassEntityPersister, getSubclassFormulaAliasClosure, getSubclassFormulaClosure, getSubclassFormulaLazyiness, getSubclassFormulaTemplateClosure, getSubclassPropertyColumnAliases, getSubclassPropertyColumnNameClosure, getSubclassPropertyColumnNames, getSubclassPropertyColumnNames, getSubclassPropertyFormulaTemplateClosure, getSubclassPropertyName, getSubclassPropertyNameClosure, getSubclassPropertySubclassNameClosure, getSubclassPropertyType, getSubclassPropertyTypeClosure, getTableUpdateNeeded, getTuplizer, getTuplizer, getType, getVersion, getVersionColumnName, getVersionedTableName, getVersionProperty, getVersionSelectString, getVersionType, guessEntityMode, hasCache, hasCascades, hasCollections, hasEmbeddedIdentifier, hasFormulaProperties, hasIdentifierProperty, hasIdentifierPropertyOrEmbeddedCompositeIdentifier, hasLazyProperties, hasProxy, hasRowId, hasSequentialSelect, hasSubclasses, hasSubselectLoadableCollections, hasUninitializedLazyProperties, hasWhere, hydrate, identifierSelectFragment, implementsLifecycle, implementsValidatable, initializeLazyProperty, initLockers, initPropertyPaths, initSubclassPropertyAliasesMap, insert, insert, insert, insert, instantiate, isAbstract, isBatchable, isBatchLoadable, isCacheInvalidationRequired, isCollection, isDefinedOnSubclass, isDeleteCallable, isExplicitPolymorphism, isIdentifierAssignedByInsert, isInherited, isInsertCallable, isInstance, isInverseSubclassTable, isInverseTable, isLazyAvailable, isMutable, isNullableSubclassTable, isNullableTable, isPolymorphic, isSelectBeforeUpdateRequired, isSubclassEntityName, isSubclassPropertyDeferred, isSubclassPropertyNullable, isSubclassTableLazy, isSubclassTableSequentialSelect, isTransient, isUpdateCallable, isVersioned, load, loadByUniqueKey, lock, logStaticSQL, oneToManyFilterFragment, optimisticLockMode, postConstruct, postInstantiate, propertySelectFragment, renderSelect, resetIdentifier, selectFragment, selectFragment, setIdentifier, setPropertyValue, setPropertyValue, setPropertyValues, toColumns, toColumns, toColumns, toString, toType, update, update, updateOrInsert, useDynamicInsert, useDynamicUpdate, useGetGeneratedKeys, useInsertSelectIdentity, whereJoinFragment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnionSubclassEntityPersister

public UnionSubclassEntityPersister(PersistentClass persistentClass,
                                    CacheConcurrencyStrategy cache,
                                    SessionFactoryImplementor factory,
                                    Mapping mapping)
                             throws HibernateException
Method Detail

getQuerySpaces

public Serializable[] getQuerySpaces()
Description copied from interface: EntityPersister
Returns an array of objects that identify spaces in which properties of this class are persisted, for instances of this class and its subclasses.

Specified by:
getQuerySpaces in interface EntityPersister
Overrides:
getQuerySpaces in class BasicEntityPersister

getTableName

public String getTableName()
Description copied from interface: Joinable
The table to join to.


getDiscriminatorType

public Type getDiscriminatorType()
Description copied from interface: Loadable
Get the discriminator type


getDiscriminatorSQLValue

public String getDiscriminatorSQLValue()
Description copied from interface: Queryable
Get the discriminator value for this particular concrete subclass, as a string that may be embedded in a select statement


getSubclassClosure

public String[] getSubclassClosure()

getSubclassForDiscriminatorValue

public String getSubclassForDiscriminatorValue(Object value)
Description copied from interface: Loadable
Get the concrete subclass corresponding to the given discriminator value


getPropertySpaces

public Serializable[] getPropertySpaces()
Description copied from interface: EntityPersister
Returns an array of objects that identify spaces in which properties of this class are persisted, for instances of this class only.


isDiscriminatorFormula

protected boolean isDiscriminatorFormula()

generateSelectString

protected String generateSelectString(LockMode lockMode)
Generate the SQL that selects a row by id


getDiscriminatorFormula

protected String getDiscriminatorFormula()

getTableName

protected String getTableName(int j)
Specified by:
getTableName in class BasicEntityPersister

getKeyColumns

protected String[] getKeyColumns(int j)
Specified by:
getKeyColumns in class BasicEntityPersister

isTableCascadeDeleteEnabled

protected boolean isTableCascadeDeleteEnabled(int j)
Specified by:
isTableCascadeDeleteEnabled in class BasicEntityPersister

isPropertyOfTable

protected boolean isPropertyOfTable(int property,
                                    int j)
Specified by:
isPropertyOfTable in class BasicEntityPersister

fromTableFragment

public String fromTableFragment(String name)
Description copied from interface: OuterJoinLoadable
Get the main from table fragment, given a query alias.


filterFragment

public String filterFragment(String name)
Specified by:
filterFragment in class BasicEntityPersister

getSubclassPropertyTableName

public String getSubclassPropertyTableName(int i)
Description copied from interface: OuterJoinLoadable
Return the table name used to persist the numbered property of the class or a subclass.


addDiscriminatorToSelect

protected void addDiscriminatorToSelect(SelectFragment select,
                                        String name,
                                        String suffix)
Overrides:
addDiscriminatorToSelect in class BasicEntityPersister

getPropertyTableNumbersInSelect

protected int[] getPropertyTableNumbersInSelect()
Specified by:
getPropertyTableNumbersInSelect in class BasicEntityPersister

getSubclassPropertyTableNumber

protected int getSubclassPropertyTableNumber(int i)
Specified by:
getSubclassPropertyTableNumber in class BasicEntityPersister

getSubclassPropertyTableNumber

protected int getSubclassPropertyTableNumber(String propertyName)
Description copied from class: BasicEntityPersister
Warning: When there are duplicated property names in the subclasses of the class, this method may return the wrong table number for the duplicated subclass property (note that SingleTableEntityPersister defines an overloaded form which takes the entity name.

Overrides:
getSubclassPropertyTableNumber in class BasicEntityPersister

getTableSpan

protected int getTableSpan()
Specified by:
getTableSpan in class BasicEntityPersister

getSubclassColumnTableNumberClosure

protected int[] getSubclassColumnTableNumberClosure()
Specified by:
getSubclassColumnTableNumberClosure in class BasicEntityPersister

getSubclassFormulaTableNumberClosure

protected int[] getSubclassFormulaTableNumberClosure()
Specified by:
getSubclassFormulaTableNumberClosure in class BasicEntityPersister

getTableHasColumns

protected boolean[] getTableHasColumns()

getPropertyTableNumbers

protected int[] getPropertyTableNumbers()
Specified by:
getPropertyTableNumbers in class BasicEntityPersister

generateSubquery

protected String generateSubquery(PersistentClass model,
                                  Mapping mapping)

getSubclassTableKeyColumns

protected String[] getSubclassTableKeyColumns(int j)
Specified by:
getSubclassTableKeyColumns in class BasicEntityPersister

getSubclassTableName

protected String getSubclassTableName(int j)
Specified by:
getSubclassTableName in class BasicEntityPersister

getSubclassTableSpan

protected int getSubclassTableSpan()
Specified by:
getSubclassTableSpan in class BasicEntityPersister

isClassOrSuperclassTable

protected boolean isClassOrSuperclassTable(int j)
Specified by:
isClassOrSuperclassTable in class BasicEntityPersister

getPropertyTableName

public String getPropertyTableName(String propertyName)
Description copied from interface: OuterJoinLoadable
Get the table name for the given property path