Package org.hibernate.mapping
Class PersistentClass
java.lang.Object
org.hibernate.mapping.PersistentClass
- All Implemented Interfaces:
Serializable,AttributeContainer,Contributable,Filterable,IdentifiableTypeClass,MetaAttributable,TableContainer
public abstract sealed class PersistentClass
extends Object
implements IdentifiableTypeClass, AttributeContainer, Filterable, MetaAttributable, Contributable, Serializable
permits RootClass, Subclass
A mapping model object that represents an entity class.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe magic value ofDiscriminatorValue.value()which indicates that the subclass is distinguished by any non-null value of the discriminator column.static final StringThe magic value ofDiscriminatorValue.value()which indicates that the subclass is distinguished by a null value of the discriminator column. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ObjectvoidaddCallbackDefinitions(List<CallbackDefinition> callbackDefinitions) voidaddCheckConstraint(CheckConstraint checkConstraint) voidaddFilter(String name, String condition, boolean autoAliasInjection, Map<String, String> aliasTableMap, Map<String, String> aliasEntityMap) voidvoidvoidaddProperty(Property property) Add a property to thisPersistentClassorJoin.voidaddSubclass(Subclass subclass) protected voidaddSubclassJoin(Join join) protected voidaddSubclassProperty(Property prop) protected voidaddSubclassTable(Table subclassTable) voidaddSynchronizedTable(String table) voidapplyProperty(Property property) voidassignCheckConstraintsToTable(Dialect dialect, TypeConfiguration types) protected voidbooleanvoidcreateConstraints(MetadataBuildingContext context) voidfindSecondaryTable(String name) intabstract StringThe name of the contributor which contributed thisabstract Propertyabstract PropertySupplier<? extends Expectation> abstract Valueabstract KeyValueabstract PropertySupplier<? extends Expectation> intintgetJoinNumber(Property prop) getJoins()abstract KeyValuegetKey()Class<?> getMetaAttribute(String name) abstract StringBuild a list of the properties defined on this class.getProperty(String propertyName) intClass<?> getRecursiveProperty(String propertyPath) Build a list of properties which may be referenced in association mappings.getReferencedProperty(String propertyPath) Given a property path, locate the appropriate referenceable property reference.abstract RootClassabstract TablegetSecondaryTable(String name) Get the subclasses in a special 'order', most derived subclasses first.abstract intintabstract PersistentClassabstract TablegetTable()Get a list of the properties defined on this class which are not defined as part of a join.Supplier<? extends Expectation> abstract Propertyabstract StringgetWhere()booleanabstract booleanbooleanabstract booleanbooleanbooleanbooleanbooleanhasProperty(String name) Check to see if this PersistentClass defines a property with the given name.booleanbooleanbooleanbooleanisCached()booleanisClassOrSuperclassJoin(Join join) booleanisClassOrSuperclassTable(Table closureTable) abstract booleanbooleanbooleanbooleanbooleanisDefinedOnMultipleSubclasses(Column column) abstract booleanbooleanbooleanbooleanDeprecated.No longer supportedbooleanabstract booleanabstract booleanbooleanisLazy()abstract booleanabstract booleanbooleanCheck to see if a property with the given name exists in this PersistentClass or in any of its super hierarchy.booleanCheck to see if a property with the given name exists in the super hierarchy of this PersistentClass.abstract booleanvoidvoidremoveProperty(Property property) voidsetAbstract(Boolean isAbstract) voidsetBatchSize(int batchSize) voidsetCached(boolean cached) voidsetClassName(String className) voidsetCustomSQLDelete(String customSQLDelete, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) voidsetCustomSQLInsert(String customSQLInsert, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) voidsetCustomSQLUpdate(String customSQLUpdate, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) voidsetDeclaredIdentifierMapper(Component declaredIdentifierMapper) voidsetDeleteExpectation(Supplier<? extends Expectation> deleteExpectation) voidsetDiscriminatorValue(String discriminatorValue) voidsetDynamicInsert(boolean dynamicInsert) voidsetDynamicUpdate(boolean dynamicUpdate) voidsetEntityName(String entityName) voidsetIdentifierMapper(Component handle) voidsetInsertExpectation(Supplier<? extends Expectation> insertExpectation) voidsetJpaEntityName(String jpaEntityName) voidsetLazy(boolean lazy) voidsetLoaderName(String loaderName) voidsetMetaAttributes(Map<String, MetaAttribute> metas) voidsetOptimisticLockStyle(OptimisticLockStyle optimisticLockStyle) voidsetProxyInterfaceName(String proxyInterfaceName) voidsetQueryCacheLayout(CacheLayout queryCacheLayout) voidsetSelectBeforeUpdate(boolean selectBeforeUpdate) voidsetSubselectLoadableCollections(boolean hasSubselectCollections) voidsetSuperMappedSuperclass(MappedSuperclass superMappedSuperclass) voidsetUpdateExpectation(Supplier<? extends Expectation> updateExpectation) toString()booleanbooleanvoid
-
Field Details
-
NULL_DISCRIMINATOR_MAPPING
The magic value ofDiscriminatorValue.value()which indicates that the subclass is distinguished by a null value of the discriminator column.- See Also:
-
NOT_NULL_DISCRIMINATOR_MAPPING
The magic value ofDiscriminatorValue.value()which indicates that the subclass is distinguished by any non-null value of the discriminator column.- See Also:
-
synchronizedTables
-
-
Constructor Details
-
PersistentClass
-
-
Method Details
-
getContributor
Description copied from interface:ContributableThe name of the contributor which contributed this- Specified by:
getContributorin interfaceContributable
-
getServiceRegistry
-
getClassName
-
setClassName
-
getProxyInterfaceName
-
setProxyInterfaceName
-
getMappedClass
- Throws:
MappingException
-
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
-
addSubclass
- Throws:
MappingException
-
hasSubclasses
public boolean hasSubclasses() -
getSubclassSpan
public int getSubclassSpan() -
getSubclasses
Get the subclasses in a special 'order', most derived subclasses first. -
getSubclassClosure
-
getIdentityTable
-
getDirectSubclasses
-
addProperty
Description copied from interface:AttributeContainerAdd a property to thisPersistentClassorJoin.- Specified by:
addPropertyin interfaceAttributeContainer
-
contains
- Specified by:
containsin interfaceAttributeContainer
-
getTable
- Specified by:
getTablein interfaceAttributeContainer
-
getEntityName
-
isMutable
public abstract boolean isMutable() -
hasIdentifierProperty
public abstract boolean hasIdentifierProperty() -
getIdentifierProperty
-
getDeclaredIdentifierProperty
-
getIdentifier
-
getVersion
-
getDeclaredVersion
-
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) -
getQueryCacheLayout
-
setQueryCacheLayout
-
getCacheConcurrencyStrategy
-
getNaturalIdCacheRegionName
-
getSuperclass
-
isExplicitPolymorphism
Deprecated.No longer supported -
isDiscriminatorInsertable
public abstract boolean isDiscriminatorInsertable() -
getPropertyClosure
-
getTableClosure
-
getKeyClosure
-
addSubclassProperty
-
addSubclassJoin
-
addSubclassTable
-
getSubclassPropertyClosure
-
getSubclassJoinClosure
-
getSubclassTableClosure
-
isClassOrSuperclassJoin
-
isClassOrSuperclassTable
-
isLazy
public boolean isLazy() -
setLazy
public void setLazy(boolean lazy) -
isConcreteProxy
public abstract boolean isConcreteProxy() -
hasEmbeddedIdentifier
public abstract boolean hasEmbeddedIdentifier() -
getRootTable
-
getRootClass
-
getKey
-
setDiscriminatorValue
-
setEntityName
-
createPrimaryKey
public void createPrimaryKey() -
getWhere
-
getBatchSize
public int getBatchSize() -
setBatchSize
public void setBatchSize(int batchSize) -
hasSelectBeforeUpdate
public boolean hasSelectBeforeUpdate() -
setSelectBeforeUpdate
public void setSelectBeforeUpdate(boolean selectBeforeUpdate) -
getReferenceableProperties
Build a list 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:
-
getReferencedProperty
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
- Throws:
MappingException
-
getProperty
- Throws:
MappingException
-
hasProperty
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
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
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
-
getOptimisticLockStyle
-
setOptimisticLockStyle
-
validate
- Throws:
MappingException
-
isDiscriminatorValueNotNull
public boolean isDiscriminatorValueNotNull() -
isDiscriminatorValueNull
public boolean isDiscriminatorValueNull() -
getMetaAttributes
- Specified by:
getMetaAttributesin interfaceMetaAttributable
-
setMetaAttributes
- Specified by:
setMetaAttributesin interfaceMetaAttributable
-
getMetaAttribute
- Specified by:
getMetaAttributein interfaceMetaAttributable
-
toString
-
getJoins
-
getJoinClosure
-
addJoin
-
getJoinClosureSpan
public int getJoinClosureSpan() -
getPropertyClosureSpan
public int getPropertyClosureSpan() -
getJoinNumber
-
getProperties
Build a list of the properties defined on this class. The returned iterator only accounts for "normal" properties (i.e. non-identifier properties).Differs from
getUnjoinedProperties()in that the returned list will include properties defined as part of a join.Differs from
getReferenceableProperties()in that the properties defined in superclasses of the mapping inheritance are not included.- Returns:
- A list over the "normal" properties.
-
getUnjoinedProperties
Get a list of the properties defined on this class which are not defined as part of a join. As withgetProperties(), the returned iterator only accounts for non-identifier properties.- Returns:
- An iterator over the non-joined "normal" properties.
-
setCustomSQLInsert
public void setCustomSQLInsert(String customSQLInsert, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) -
getCustomSQLInsert
-
isCustomInsertCallable
public boolean isCustomInsertCallable() -
setCustomSQLUpdate
public void setCustomSQLUpdate(String customSQLUpdate, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) -
getCustomSQLUpdate
-
isCustomUpdateCallable
public boolean isCustomUpdateCallable() -
setCustomSQLDelete
public void setCustomSQLDelete(String customSQLDelete, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) -
getCustomSQLDelete
-
isCustomDeleteCallable
public boolean isCustomDeleteCallable() -
addFilter
public void addFilter(String name, String condition, boolean autoAliasInjection, Map<String, String> aliasTableMap, Map<String, String> aliasEntityMap) - Specified by:
addFilterin interfaceFilterable
-
getFilters
- Specified by:
getFiltersin interfaceFilterable
-
isForceDiscriminator
public boolean isForceDiscriminator() -
isJoinedSubclass
public abstract boolean isJoinedSubclass() -
getLoaderName
-
setLoaderName
-
getSynchronizedTables
-
addSynchronizedTable
-
isAbstract
-
setAbstract
-
getNonDuplicatedProperties
-
checkColumnDuplication
protected void checkColumnDuplication() -
accept
-
getJpaEntityName
-
setJpaEntityName
-
hasPojoRepresentation
public boolean hasPojoRepresentation() -
hasSubselectLoadableCollections
public boolean hasSubselectLoadableCollections() -
setSubselectLoadableCollections
public void setSubselectLoadableCollections(boolean hasSubselectCollections) -
hasCollectionNotReferencingPK
public boolean hasCollectionNotReferencingPK() -
hasPartitionedSelectionMapping
public boolean hasPartitionedSelectionMapping() -
getIdentifierMapper
-
getDeclaredIdentifierMapper
-
setDeclaredIdentifierMapper
-
hasIdentifierMapper
public boolean hasIdentifierMapper() -
addCallbackDefinitions
-
getCallbackDefinitions
-
setIdentifierMapper
-
hasNaturalId
public boolean hasNaturalId() -
getDeclaredProperties
- Specified by:
getDeclaredPropertiesin interfaceIdentifiableTypeClass
-
addMappedSuperclassProperty
-
getSuperMappedSuperclass
-
setSuperMappedSuperclass
-
assignCheckConstraintsToTable
-
prepareForMappingModel
-
addCheckConstraint
-
getCheckConstraints
-
getImplicitTable
- Specified by:
getImplicitTablein interfaceIdentifiableTypeClass
-
findTable
- Specified by:
findTablein interfaceTableContainer
-
getTable
- Specified by:
getTablein interfaceTableContainer
-
findSecondaryTable
- Specified by:
findSecondaryTablein interfaceTableContainer
-
getSecondaryTable
- Specified by:
getSecondaryTablein interfaceTableContainer
-
getSuperType
- Specified by:
getSuperTypein interfaceIdentifiableTypeClass
-
getSubTypes
- Specified by:
getSubTypesin interfaceIdentifiableTypeClass
-
applyProperty
- Specified by:
applyPropertyin interfaceIdentifiableTypeClass
-
isDefinedOnMultipleSubclasses
-
getSuperPersistentClass
-
getInsertExpectation
-
setInsertExpectation
-
getUpdateExpectation
-
setUpdateExpectation
-
getDeleteExpectation
-
setDeleteExpectation
-
removeProperty
-
createConstraints
-