Package org.hibernate.mapping
Class PersistentClass
- java.lang.Object
-
- org.hibernate.mapping.PersistentClass
-
- All Implemented Interfaces:
java.io.Serializable,AttributeContainer,Filterable,MetaAttributable
public abstract class PersistentClass extends java.lang.Object implements AttributeContainer, java.io.Serializable, Filterable, MetaAttributable
Mapping for an entity.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNOT_NULL_DISCRIMINATOR_MAPPINGstatic java.lang.StringNULL_DISCRIMINATOR_MAPPINGprotected java.util.Set<java.lang.String>synchronizedTables
-
Constructor Summary
Constructors Constructor Description PersistentClass(MetadataBuildingContext metadataBuildingContext)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract java.lang.Objectaccept(PersistentClassVisitor mv)voidaddFilter(java.lang.String name, java.lang.String condition, boolean autoAliasInjection, java.util.Map<java.lang.String,java.lang.String> aliasTableMap, java.util.Map<java.lang.String,java.lang.String> aliasEntityMap)voidaddJoin(Join join)voidaddMappedsuperclassProperty(Property p)voidaddProperty(Property p)voidaddSubclass(Subclass subclass)protected voidaddSubclassJoin(Join join)protected voidaddSubclassProperty(Property prop)protected voidaddSubclassTable(Table subclassTable)voidaddSynchronizedTable(java.lang.String table)voidaddTuplizer(EntityMode entityMode, java.lang.String implClassName)protected voidcheckColumnDuplication()protected voidcheckColumnDuplication(java.util.Set distinctColumns, java.util.Iterator columns)protected voidcheckPropertyColumnDuplication(java.util.Set distinctColumns, java.util.Iterator properties)voidcreatePrimaryKey()intgetBatchSize()abstract java.lang.StringgetCacheConcurrencyStrategy()java.lang.StringgetClassName()java.lang.StringgetCustomSQLDelete()ExecuteUpdateResultCheckStylegetCustomSQLDeleteCheckStyle()java.lang.StringgetCustomSQLInsert()ExecuteUpdateResultCheckStylegetCustomSQLInsertCheckStyle()java.lang.StringgetCustomSQLUpdate()ExecuteUpdateResultCheckStylegetCustomSQLUpdateCheckStyle()ComponentgetDeclaredIdentifierMapper()abstract PropertygetDeclaredIdentifierProperty()java.util.IteratorgetDeclaredPropertyIterator()abstract PropertygetDeclaredVersion()java.util.IteratorgetDirectSubclasses()abstract ValuegetDiscriminator()protected java.util.IteratorgetDiscriminatorColumnIterator()java.lang.StringgetDiscriminatorValue()java.lang.StringgetEntityName()abstract java.lang.ClassgetEntityPersisterClass()java.util.ListgetFilters()abstract KeyValuegetIdentifier()ComponentgetIdentifierMapper()abstract PropertygetIdentifierProperty()TablegetIdentityTable()java.util.IteratorgetJoinClosureIterator()intgetJoinClosureSpan()java.util.IteratorgetJoinIterator()intgetJoinNumber(Property prop)java.lang.StringgetJpaEntityName()abstract KeyValuegetKey()abstract java.util.IteratorgetKeyClosureIterator()java.lang.StringgetLoaderName()java.lang.ClassgetMappedClass()MetaAttributegetMetaAttribute(java.lang.String name)java.util.MapgetMetaAttributes()abstract java.lang.StringgetNaturalIdCacheRegionName()protected java.util.IteratorgetNonDuplicatedPropertyIterator()intgetOptimisticLockMode()Deprecated.prefergetOptimisticLockStyle()OptimisticLockStylegetOptimisticLockStyle()PropertygetProperty(java.lang.String propertyName)abstract java.util.IteratorgetPropertyClosureIterator()intgetPropertyClosureSpan()java.util.IteratorgetPropertyIterator()Build an iterator over the properties defined on this class.java.lang.ClassgetProxyInterface()java.lang.StringgetProxyInterfaceName()PropertygetRecursiveProperty(java.lang.String propertyPath)java.util.IteratorgetReferenceablePropertyIterator()Build an iterator of properties which may be referenced in association mappings.PropertygetReferencedProperty(java.lang.String propertyPath)Given a property path, locate the appropriate referenceable property reference.abstract RootClassgetRootClass()abstract TablegetRootTable()ServiceRegistrygetServiceRegistry()java.util.IteratorgetSubclassClosureIterator()abstract intgetSubclassId()java.util.IteratorgetSubclassIterator()Iterate over subclasses in a special 'order', most derived subclasses first.java.util.IteratorgetSubclassJoinClosureIterator()java.util.IteratorgetSubclassPropertyClosureIterator()intgetSubclassSpan()java.util.IteratorgetSubclassTableClosureIterator()abstract PersistentClassgetSuperclass()MappedSuperclassgetSuperMappedSuperclass()abstract java.util.SetgetSynchronizedTables()abstract TablegetTable()abstract java.util.IteratorgetTableClosureIterator()java.lang.StringgetTuplizerImplClassName(EntityMode mode)java.util.MapgetTuplizerMap()java.util.IteratorgetUnjoinedPropertyIterator()Build an iterator over the properties defined on this class which are not defined as part of a join.abstract PropertygetVersion()abstract java.lang.StringgetWhere()abstract booleanhasEmbeddedIdentifier()booleanhasIdentifierMapper()abstract booleanhasIdentifierProperty()booleanhasNaturalId()booleanhasPojoRepresentation()booleanhasProperty(java.lang.String name)Check to see if this PersistentClass defines a property with the given name.booleanhasSelectBeforeUpdate()booleanhasSubclasses()booleanhasSubselectLoadableCollections()java.lang.BooleanisAbstract()booleanisCached()booleanisCachingExplicitlyRequested()Deprecated.UseisCachedinsteadbooleanisClassOrSuperclassJoin(Join join)booleanisClassOrSuperclassTable(Table closureTable)booleanisCustomDeleteCallable()booleanisCustomInsertCallable()booleanisCustomUpdateCallable()abstract booleanisDiscriminatorInsertable()booleanisDiscriminatorValueNotNull()booleanisDiscriminatorValueNull()abstract booleanisExplicitPolymorphism()booleanisForceDiscriminator()abstract booleanisInherited()abstract booleanisJoinedSubclass()booleanisLazy()abstract booleanisMutable()abstract booleanisPolymorphic()booleanisPropertyDefinedInHierarchy(java.lang.String name)Check to see if a property with the given name exists in this PersistentClass or in any of its super hierarchy.booleanisPropertyDefinedInSuperHierarchy(java.lang.String name)Check to see if a property with the given name exists in the super hierarchy of this PersistentClass.abstract booleanisVersioned()voidsetAbstract(java.lang.Boolean isAbstract)voidsetBatchSize(int batchSize)voidsetCached(boolean cached)voidsetCachingExplicitlyRequested(boolean cached)Deprecated.UsesetCached(boolean)insteadvoidsetClassName(java.lang.String className)voidsetCustomSQLDelete(java.lang.String customSQLDelete, boolean callable, ExecuteUpdateResultCheckStyle checkStyle)voidsetCustomSQLInsert(java.lang.String customSQLInsert, boolean callable, ExecuteUpdateResultCheckStyle checkStyle)voidsetCustomSQLUpdate(java.lang.String customSQLUpdate, boolean callable, ExecuteUpdateResultCheckStyle checkStyle)voidsetDeclaredIdentifierMapper(Component declaredIdentifierMapper)voidsetDiscriminatorValue(java.lang.String discriminatorValue)voidsetDynamicInsert(boolean dynamicInsert)voidsetDynamicUpdate(boolean dynamicUpdate)voidsetEntityName(java.lang.String entityName)abstract voidsetEntityPersisterClass(java.lang.Class classPersisterClass)voidsetIdentifierMapper(Component handle)voidsetJpaEntityName(java.lang.String jpaEntityName)voidsetLazy(boolean lazy)voidsetLoaderName(java.lang.String loaderName)voidsetMetaAttributes(java.util.Map metas)voidsetOptimisticLockMode(int optimisticLockMode)Deprecated.voidsetOptimisticLockStyle(OptimisticLockStyle optimisticLockStyle)voidsetProxyInterfaceName(java.lang.String proxyInterfaceName)voidsetSelectBeforeUpdate(boolean selectBeforeUpdate)voidsetSubselectLoadableCollections(boolean hasSubselectCollections)voidsetSuperMappedSuperclass(MappedSuperclass superMappedSuperclass)java.lang.StringtoString()booleanuseDynamicInsert()booleanuseDynamicUpdate()voidvalidate(Mapping mapping)
-
-
-
Field Detail
-
NULL_DISCRIMINATOR_MAPPING
public static final java.lang.String NULL_DISCRIMINATOR_MAPPING
- See Also:
- Constant Field Values
-
NOT_NULL_DISCRIMINATOR_MAPPING
public static final java.lang.String NOT_NULL_DISCRIMINATOR_MAPPING
- See Also:
- Constant Field Values
-
synchronizedTables
protected final java.util.Set<java.lang.String> synchronizedTables
-
-
Constructor Detail
-
PersistentClass
public PersistentClass(MetadataBuildingContext metadataBuildingContext)
-
-
Method Detail
-
getServiceRegistry
public ServiceRegistry getServiceRegistry()
-
getClassName
public java.lang.String getClassName()
-
setClassName
public void setClassName(java.lang.String className)
-
getProxyInterfaceName
public java.lang.String getProxyInterfaceName()
-
setProxyInterfaceName
public void setProxyInterfaceName(java.lang.String proxyInterfaceName)
-
getMappedClass
public java.lang.Class getMappedClass() throws MappingException- Throws:
MappingException
-
getProxyInterface
public java.lang.Class getProxyInterface()
-
useDynamicInsert
public boolean useDynamicInsert()
-
getSubclassId
public abstract int getSubclassId()
-
useDynamicUpdate
public boolean useDynamicUpdate()
-
setDynamicInsert
public void setDynamicInsert(boolean dynamicInsert)
-
setDynamicUpdate
public void setDynamicUpdate(boolean dynamicUpdate)
-
getDiscriminatorValue
public java.lang.String getDiscriminatorValue()
-
addSubclass
public void addSubclass(Subclass subclass) throws MappingException
- Throws:
MappingException
-
hasSubclasses
public boolean hasSubclasses()
-
getSubclassSpan
public int getSubclassSpan()
-
getSubclassIterator
public java.util.Iterator getSubclassIterator()
Iterate over subclasses in a special 'order', most derived subclasses first.
-
getSubclassClosureIterator
public java.util.Iterator getSubclassClosureIterator()
-
getIdentityTable
public Table getIdentityTable()
-
getDirectSubclasses
public java.util.Iterator getDirectSubclasses()
-
addProperty
public void addProperty(Property p)
- Specified by:
addPropertyin interfaceAttributeContainer
-
getTable
public abstract Table getTable()
-
getEntityName
public java.lang.String getEntityName()
-
isMutable
public abstract boolean isMutable()
-
hasIdentifierProperty
public abstract boolean hasIdentifierProperty()
-
getIdentifierProperty
public abstract Property getIdentifierProperty()
-
getDeclaredIdentifierProperty
public abstract Property getDeclaredIdentifierProperty()
-
getIdentifier
public abstract KeyValue getIdentifier()
-
getVersion
public abstract Property getVersion()
-
getDeclaredVersion
public abstract Property getDeclaredVersion()
-
getDiscriminator
public abstract Value getDiscriminator()
-
isInherited
public abstract boolean isInherited()
-
isPolymorphic
public abstract boolean isPolymorphic()
-
isVersioned
public abstract boolean isVersioned()
-
isCached
public boolean isCached()
-
setCached
public void setCached(boolean cached)
-
isCachingExplicitlyRequested
@Deprecated public boolean isCachingExplicitlyRequested()
Deprecated.UseisCachedinstead
-
setCachingExplicitlyRequested
@Deprecated public void setCachingExplicitlyRequested(boolean cached)
Deprecated.UsesetCached(boolean)instead
-
getCacheConcurrencyStrategy
public abstract java.lang.String getCacheConcurrencyStrategy()
-
getNaturalIdCacheRegionName
public abstract java.lang.String getNaturalIdCacheRegionName()
-
getSuperclass
public abstract PersistentClass getSuperclass()
-
isExplicitPolymorphism
public abstract boolean isExplicitPolymorphism()
-
isDiscriminatorInsertable
public abstract boolean isDiscriminatorInsertable()
-
getPropertyClosureIterator
public abstract java.util.Iterator getPropertyClosureIterator()
-
getTableClosureIterator
public abstract java.util.Iterator getTableClosureIterator()
-
getKeyClosureIterator
public abstract java.util.Iterator getKeyClosureIterator()
-
addSubclassProperty
protected void addSubclassProperty(Property prop)
-
addSubclassJoin
protected void addSubclassJoin(Join join)
-
addSubclassTable
protected void addSubclassTable(Table subclassTable)
-
getSubclassPropertyClosureIterator
public java.util.Iterator getSubclassPropertyClosureIterator()
-
getSubclassJoinClosureIterator
public java.util.Iterator getSubclassJoinClosureIterator()
-
getSubclassTableClosureIterator
public java.util.Iterator getSubclassTableClosureIterator()
-
isClassOrSuperclassJoin
public boolean isClassOrSuperclassJoin(Join join)
-
isClassOrSuperclassTable
public boolean isClassOrSuperclassTable(Table closureTable)
-
isLazy
public boolean isLazy()
-
setLazy
public void setLazy(boolean lazy)
-
hasEmbeddedIdentifier
public abstract boolean hasEmbeddedIdentifier()
-
getEntityPersisterClass
public abstract java.lang.Class getEntityPersisterClass()
-
setEntityPersisterClass
public abstract void setEntityPersisterClass(java.lang.Class classPersisterClass)
-
getRootTable
public abstract Table getRootTable()
-
getRootClass
public abstract RootClass getRootClass()
-
getKey
public abstract KeyValue getKey()
-
setDiscriminatorValue
public void setDiscriminatorValue(java.lang.String discriminatorValue)
-
setEntityName
public void setEntityName(java.lang.String entityName)
-
createPrimaryKey
public void createPrimaryKey()
-
getWhere
public abstract java.lang.String getWhere()
-
getBatchSize
public int getBatchSize()
-
setBatchSize
public void setBatchSize(int batchSize)
-
hasSelectBeforeUpdate
public boolean hasSelectBeforeUpdate()
-
setSelectBeforeUpdate
public void setSelectBeforeUpdate(boolean selectBeforeUpdate)
-
getReferenceablePropertyIterator
public java.util.Iterator getReferenceablePropertyIterator()
Build an iterator of properties which may be referenced in association mappings.Includes properties defined in superclasses of the mapping inheritance. Includes all properties defined as part of a join.
- Returns:
- The referenceable property iterator.
- See Also:
for a discussion of "referenceable"
-
getReferencedProperty
public Property getReferencedProperty(java.lang.String propertyPath) throws MappingException
Given a property path, locate the appropriate referenceable property reference. A referenceable property is a property which can be a target of a foreign-key mapping (e.g.@ManyToOne,@OneToOne).- Parameters:
propertyPath- The property path to resolve into a property reference.- Returns:
- The property reference (never null).
- Throws:
MappingException- If the property could not be found.
-
getRecursiveProperty
public Property getRecursiveProperty(java.lang.String propertyPath) throws MappingException
- Throws:
MappingException
-
getProperty
public Property getProperty(java.lang.String propertyName) throws MappingException
- Throws:
MappingException
-
hasProperty
public boolean hasProperty(java.lang.String name)
Check to see if this PersistentClass defines a property with the given name.- Parameters:
name- The property name to check- Returns:
trueif a property with that name exists;falseif not
-
isPropertyDefinedInSuperHierarchy
public boolean isPropertyDefinedInSuperHierarchy(java.lang.String name)
Check to see if a property with the given name exists in the super hierarchy of this PersistentClass. Does not check this PersistentClass, just up the hierarchy- Parameters:
name- The property name to check- Returns:
trueif a property with that name exists;falseif not
-
isPropertyDefinedInHierarchy
public boolean isPropertyDefinedInHierarchy(java.lang.String name)
Check to see if a property with the given name exists in this PersistentClass or in any of its super hierarchy. UnlikeisPropertyDefinedInSuperHierarchy(java.lang.String), this method does check this PersistentClass- Parameters:
name- The property name to check- Returns:
trueif a property with that name exists;falseif not
-
getOptimisticLockMode
@Deprecated public int getOptimisticLockMode()
Deprecated.prefergetOptimisticLockStyle()
-
setOptimisticLockMode
@Deprecated public void setOptimisticLockMode(int optimisticLockMode)
Deprecated.
-
getOptimisticLockStyle
public OptimisticLockStyle getOptimisticLockStyle()
-
setOptimisticLockStyle
public void setOptimisticLockStyle(OptimisticLockStyle optimisticLockStyle)
-
validate
public void validate(Mapping mapping) throws MappingException
- Throws:
MappingException
-
isDiscriminatorValueNotNull
public boolean isDiscriminatorValueNotNull()
-
isDiscriminatorValueNull
public boolean isDiscriminatorValueNull()
-
getMetaAttributes
public java.util.Map getMetaAttributes()
- Specified by:
getMetaAttributesin interfaceMetaAttributable
-
setMetaAttributes
public void setMetaAttributes(java.util.Map metas)
- Specified by:
setMetaAttributesin interfaceMetaAttributable
-
getMetaAttribute
public MetaAttribute getMetaAttribute(java.lang.String name)
- Specified by:
getMetaAttributein interfaceMetaAttributable
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getJoinIterator
public java.util.Iterator getJoinIterator()
-
getJoinClosureIterator
public java.util.Iterator getJoinClosureIterator()
-
addJoin
public void addJoin(Join join)
-
getJoinClosureSpan
public int getJoinClosureSpan()
-
getPropertyClosureSpan
public int getPropertyClosureSpan()
-
getJoinNumber
public int getJoinNumber(Property prop)
-
getPropertyIterator
public java.util.Iterator getPropertyIterator()
Build an iterator over the properties defined on this class. The returned iterator only accounts for "normal" properties (i.e. non-identifier properties). Differs fromgetUnjoinedPropertyIterator()in that the returned iterator will include properties defined as part of a join. Differs fromgetReferenceablePropertyIterator()in that the properties defined in superclasses of the mapping inheritance are not included.- Returns:
- An iterator over the "normal" properties.
-
getUnjoinedPropertyIterator
public java.util.Iterator getUnjoinedPropertyIterator()
Build an iterator over the properties defined on this class which are not defined as part of a join. As withgetPropertyIterator(), the returned iterator only accounts for non-identifier properties.- Returns:
- An iterator over the non-joined "normal" properties.
-
setCustomSQLInsert
public void setCustomSQLInsert(java.lang.String customSQLInsert, boolean callable, ExecuteUpdateResultCheckStyle checkStyle)
-
getCustomSQLInsert
public java.lang.String getCustomSQLInsert()
-
isCustomInsertCallable
public boolean isCustomInsertCallable()
-
getCustomSQLInsertCheckStyle
public ExecuteUpdateResultCheckStyle getCustomSQLInsertCheckStyle()
-
setCustomSQLUpdate
public void setCustomSQLUpdate(java.lang.String customSQLUpdate, boolean callable, ExecuteUpdateResultCheckStyle checkStyle)
-
getCustomSQLUpdate
public java.lang.String getCustomSQLUpdate()
-
isCustomUpdateCallable
public boolean isCustomUpdateCallable()
-
getCustomSQLUpdateCheckStyle
public ExecuteUpdateResultCheckStyle getCustomSQLUpdateCheckStyle()
-
setCustomSQLDelete
public void setCustomSQLDelete(java.lang.String customSQLDelete, boolean callable, ExecuteUpdateResultCheckStyle checkStyle)
-
getCustomSQLDelete
public java.lang.String getCustomSQLDelete()
-
isCustomDeleteCallable
public boolean isCustomDeleteCallable()
-
getCustomSQLDeleteCheckStyle
public ExecuteUpdateResultCheckStyle getCustomSQLDeleteCheckStyle()
-
addFilter
public void addFilter(java.lang.String name, java.lang.String condition, boolean autoAliasInjection, java.util.Map<java.lang.String,java.lang.String> aliasTableMap, java.util.Map<java.lang.String,java.lang.String> aliasEntityMap)- Specified by:
addFilterin interfaceFilterable
-
getFilters
public java.util.List getFilters()
- Specified by:
getFiltersin interfaceFilterable
-
isForceDiscriminator
public boolean isForceDiscriminator()
-
isJoinedSubclass
public abstract boolean isJoinedSubclass()
-
getLoaderName
public java.lang.String getLoaderName()
-
setLoaderName
public void setLoaderName(java.lang.String loaderName)
-
getSynchronizedTables
public abstract java.util.Set getSynchronizedTables()
-
addSynchronizedTable
public void addSynchronizedTable(java.lang.String table)
-
isAbstract
public java.lang.Boolean isAbstract()
-
setAbstract
public void setAbstract(java.lang.Boolean isAbstract)
-
checkColumnDuplication
protected void checkColumnDuplication(java.util.Set distinctColumns, java.util.Iterator columns) throws MappingException- Throws:
MappingException
-
checkPropertyColumnDuplication
protected void checkPropertyColumnDuplication(java.util.Set distinctColumns, java.util.Iterator properties) throws MappingException- Throws:
MappingException
-
getNonDuplicatedPropertyIterator
protected java.util.Iterator getNonDuplicatedPropertyIterator()
-
getDiscriminatorColumnIterator
protected java.util.Iterator getDiscriminatorColumnIterator()
-
checkColumnDuplication
protected void checkColumnDuplication()
-
accept
public abstract java.lang.Object accept(PersistentClassVisitor mv)
-
getJpaEntityName
public java.lang.String getJpaEntityName()
-
setJpaEntityName
public void setJpaEntityName(java.lang.String jpaEntityName)
-
hasPojoRepresentation
public boolean hasPojoRepresentation()
-
hasSubselectLoadableCollections
public boolean hasSubselectLoadableCollections()
-
setSubselectLoadableCollections
public void setSubselectLoadableCollections(boolean hasSubselectCollections)
-
getIdentifierMapper
public Component getIdentifierMapper()
-
getDeclaredIdentifierMapper
public Component getDeclaredIdentifierMapper()
-
setDeclaredIdentifierMapper
public void setDeclaredIdentifierMapper(Component declaredIdentifierMapper)
-
hasIdentifierMapper
public boolean hasIdentifierMapper()
-
setIdentifierMapper
public void setIdentifierMapper(Component handle)
-
addTuplizer
public void addTuplizer(EntityMode entityMode, java.lang.String implClassName)
-
getTuplizerImplClassName
public java.lang.String getTuplizerImplClassName(EntityMode mode)
-
getTuplizerMap
public java.util.Map getTuplizerMap()
-
hasNaturalId
public boolean hasNaturalId()
-
getDeclaredPropertyIterator
public java.util.Iterator getDeclaredPropertyIterator()
-
addMappedsuperclassProperty
public void addMappedsuperclassProperty(Property p)
-
getSuperMappedSuperclass
public MappedSuperclass getSuperMappedSuperclass()
-
setSuperMappedSuperclass
public void setSuperMappedSuperclass(MappedSuperclass superMappedSuperclass)
-
-