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 class PersistentClass extends Object implements IdentifiableTypeClass, AttributeContainer, Filterable, MetaAttributable, Contributable, Serializable
A mapping model object that represents an entity class.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
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.static String
NULL_DISCRIMINATOR_MAPPING
The magic value ofDiscriminatorValue.value()
which indicates that the subclass is distinguished by a null value of the discriminator column.protected Set<String>
synchronizedTables
-
Constructor Summary
Constructors Constructor Description PersistentClass(MetadataBuildingContext buildingContext)
-
Method Summary
-
-
-
Field Detail
-
NULL_DISCRIMINATOR_MAPPING
public static final String 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:
- Constant Field Values
-
NOT_NULL_DISCRIMINATOR_MAPPING
public static final String 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:
- Constant Field Values
-
-
Constructor Detail
-
PersistentClass
public PersistentClass(MetadataBuildingContext buildingContext)
-
-
Method Detail
-
getContributor
public String getContributor()
Description copied from interface:Contributable
The name of the contributor which contributed this- Specified by:
getContributor
in interfaceContributable
-
getServiceRegistry
public ServiceRegistry getServiceRegistry()
-
getClassName
public String getClassName()
-
setClassName
public void setClassName(String className)
-
getProxyInterfaceName
public String getProxyInterfaceName()
-
setProxyInterfaceName
public void setProxyInterfaceName(String proxyInterfaceName)
-
getMappedClass
public Class<?> getMappedClass() throws MappingException
- Throws:
MappingException
-
getProxyInterface
public 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 String getDiscriminatorValue()
-
addSubclass
public void addSubclass(Subclass subclass) throws MappingException
- Throws:
MappingException
-
hasSubclasses
public boolean hasSubclasses()
-
getSubclassSpan
public int getSubclassSpan()
-
getSubclasses
public List<Subclass> getSubclasses()
Get the subclasses in a special 'order', most derived subclasses first.
-
getSubclassClosure
public List<PersistentClass> getSubclassClosure()
-
getIdentityTable
public Table getIdentityTable()
-
addProperty
public void addProperty(Property property)
Description copied from interface:AttributeContainer
Add a property to thisPersistentClass
orJoin
.- Specified by:
addProperty
in interfaceAttributeContainer
-
contains
public boolean contains(Property property)
- Specified by:
contains
in interfaceAttributeContainer
-
getTable
public abstract Table getTable()
- Specified by:
getTable
in interfaceAttributeContainer
-
getEntityName
public 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(forRemoval=true) public boolean isCachingExplicitlyRequested()
Deprecated, for removal: This API element is subject to removal in a future version.UseisCached
instead
-
setCachingExplicitlyRequested
@Deprecated(forRemoval=true) public void setCachingExplicitlyRequested(boolean cached)
Deprecated, for removal: This API element is subject to removal in a future version.UsesetCached(boolean)
instead
-
getQueryCacheLayout
public CacheLayout getQueryCacheLayout()
-
setQueryCacheLayout
public void setQueryCacheLayout(CacheLayout queryCacheLayout)
-
getCacheConcurrencyStrategy
public abstract String getCacheConcurrencyStrategy()
-
getNaturalIdCacheRegionName
public abstract String getNaturalIdCacheRegionName()
-
getSuperclass
public abstract PersistentClass getSuperclass()
-
isExplicitPolymorphism
public abstract boolean isExplicitPolymorphism()
-
isDiscriminatorInsertable
public abstract boolean isDiscriminatorInsertable()
-
addSubclassProperty
protected void addSubclassProperty(Property prop)
-
addSubclassJoin
protected void addSubclassJoin(Join join)
-
addSubclassTable
protected void addSubclassTable(Table subclassTable)
-
isClassOrSuperclassJoin
public boolean isClassOrSuperclassJoin(Join join)
-
isClassOrSuperclassTable
public boolean isClassOrSuperclassTable(Table closureTable)
-
isLazy
public boolean isLazy()
-
setLazy
public void setLazy(boolean lazy)
-
isConcreteProxy
public abstract boolean isConcreteProxy()
-
hasEmbeddedIdentifier
public abstract boolean hasEmbeddedIdentifier()
-
getEntityPersisterClass
public abstract Class<? extends EntityPersister> getEntityPersisterClass()
-
setEntityPersisterClass
public abstract void setEntityPersisterClass(Class<? extends EntityPersister> classPersisterClass)
-
getRootTable
public abstract Table getRootTable()
-
getRootClass
public abstract RootClass getRootClass()
-
getKey
public abstract KeyValue getKey()
-
setDiscriminatorValue
public void setDiscriminatorValue(String discriminatorValue)
-
setEntityName
public void setEntityName(String entityName)
-
createPrimaryKey
public void createPrimaryKey()
-
getWhere
public abstract String getWhere()
-
getBatchSize
public int getBatchSize()
-
setBatchSize
public void setBatchSize(int batchSize)
-
hasSelectBeforeUpdate
public boolean hasSelectBeforeUpdate()
-
setSelectBeforeUpdate
public void setSelectBeforeUpdate(boolean selectBeforeUpdate)
-
getReferenceableProperties
public List<Property> 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(java.lang.String)
-
getReferencedProperty
public Property getReferencedProperty(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(String propertyPath) throws MappingException
- Throws:
MappingException
-
getProperty
public Property getProperty(String propertyName) throws MappingException
- Throws:
MappingException
-
getSubclassProperty
@Deprecated(since="6.2", forRemoval=true) public Property getSubclassProperty(String propertyName) throws MappingException
Deprecated, for removal: This API element is subject to removal in a future version.This will be removed with no replacement.- Throws:
MappingException
-
hasProperty
public boolean hasProperty(String name)
Check to see if this PersistentClass defines a property with the given name.- Parameters:
name
- The property name to check- Returns:
true
if a property with that name exists;false
if not
-
isPropertyDefinedInSuperHierarchy
public boolean isPropertyDefinedInSuperHierarchy(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:
true
if a property with that name exists;false
if not
-
isPropertyDefinedInHierarchy
public boolean isPropertyDefinedInHierarchy(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:
true
if a property with that name exists;false
if not
-
getOptimisticLockMode
@Deprecated(forRemoval=true) public int getOptimisticLockMode()
Deprecated, for removal: This API element is subject to removal in a future version.prefergetOptimisticLockStyle()
-
setOptimisticLockMode
@Deprecated(forRemoval=true) public void setOptimisticLockMode(int optimisticLockMode)
Deprecated, for removal: This API element is subject to removal in a future version.
-
getOptimisticLockStyle
public OptimisticLockStyle getOptimisticLockStyle()
-
setOptimisticLockStyle
public void setOptimisticLockStyle(OptimisticLockStyle optimisticLockStyle)
-
validate
public void validate(Metadata mapping) throws MappingException
- Throws:
MappingException
-
isDiscriminatorValueNotNull
public boolean isDiscriminatorValueNotNull()
-
isDiscriminatorValueNull
public boolean isDiscriminatorValueNull()
-
getMetaAttributes
public Map<String,MetaAttribute> getMetaAttributes()
- Specified by:
getMetaAttributes
in interfaceMetaAttributable
-
setMetaAttributes
public void setMetaAttributes(Map<String,MetaAttribute> metas)
- Specified by:
setMetaAttributes
in interfaceMetaAttributable
-
getMetaAttribute
public MetaAttribute getMetaAttribute(String name)
- Specified by:
getMetaAttribute
in interfaceMetaAttributable
-
addJoin
public void addJoin(Join join)
-
getJoinClosureSpan
public int getJoinClosureSpan()
-
getPropertyClosureSpan
public int getPropertyClosureSpan()
-
getJoinNumber
public int getJoinNumber(Property prop)
-
getProperties
public List<Property> 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
public List<Property> 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
public String getCustomSQLInsert()
-
isCustomInsertCallable
public boolean isCustomInsertCallable()
-
getCustomSQLInsertCheckStyle
@Deprecated(since="6.5", forRemoval=true) public ExecuteUpdateResultCheckStyle getCustomSQLInsertCheckStyle()
Deprecated, for removal: This API element is subject to removal in a future version.
-
setCustomSQLUpdate
public void setCustomSQLUpdate(String customSQLUpdate, boolean callable, ExecuteUpdateResultCheckStyle checkStyle)
-
getCustomSQLUpdate
public String getCustomSQLUpdate()
-
isCustomUpdateCallable
public boolean isCustomUpdateCallable()
-
getCustomSQLUpdateCheckStyle
@Deprecated(since="6.5", forRemoval=true) public ExecuteUpdateResultCheckStyle getCustomSQLUpdateCheckStyle()
Deprecated, for removal: This API element is subject to removal in a future version.
-
setCustomSQLDelete
public void setCustomSQLDelete(String customSQLDelete, boolean callable, ExecuteUpdateResultCheckStyle checkStyle)
-
getCustomSQLDelete
public String getCustomSQLDelete()
-
isCustomDeleteCallable
public boolean isCustomDeleteCallable()
-
getCustomSQLDeleteCheckStyle
@Deprecated(since="6.5", forRemoval=true) public ExecuteUpdateResultCheckStyle getCustomSQLDeleteCheckStyle()
Deprecated, for removal: This API element is subject to removal in a future version.
-
addFilter
public void addFilter(String name, String condition, boolean autoAliasInjection, Map<String,String> aliasTableMap, Map<String,String> aliasEntityMap)
- Specified by:
addFilter
in interfaceFilterable
-
getFilters
public List<FilterConfiguration> getFilters()
- Specified by:
getFilters
in interfaceFilterable
-
isForceDiscriminator
public boolean isForceDiscriminator()
-
isJoinedSubclass
public abstract boolean isJoinedSubclass()
-
getLoaderName
public String getLoaderName()
-
setLoaderName
public void setLoaderName(String loaderName)
-
addSynchronizedTable
public void addSynchronizedTable(String table)
-
isAbstract
public Boolean isAbstract()
-
setAbstract
public void setAbstract(Boolean isAbstract)
-
checkColumnDuplication
protected void checkColumnDuplication()
-
accept
public abstract Object accept(PersistentClassVisitor mv)
-
getJpaEntityName
public String getJpaEntityName()
-
setJpaEntityName
public void setJpaEntityName(String jpaEntityName)
-
hasPojoRepresentation
public boolean hasPojoRepresentation()
-
hasSubselectLoadableCollections
public boolean hasSubselectLoadableCollections()
-
setSubselectLoadableCollections
public void setSubselectLoadableCollections(boolean hasSubselectCollections)
-
hasCollectionNotReferencingPK
public boolean hasCollectionNotReferencingPK()
-
hasPartitionedSelectionMapping
public boolean hasPartitionedSelectionMapping()
-
getIdentifierMapper
public Component getIdentifierMapper()
-
getDeclaredIdentifierMapper
public Component getDeclaredIdentifierMapper()
-
setDeclaredIdentifierMapper
public void setDeclaredIdentifierMapper(Component declaredIdentifierMapper)
-
hasIdentifierMapper
public boolean hasIdentifierMapper()
-
addCallbackDefinitions
public void addCallbackDefinitions(List<CallbackDefinition> callbackDefinitions)
-
getCallbackDefinitions
public List<CallbackDefinition> getCallbackDefinitions()
-
setIdentifierMapper
public void setIdentifierMapper(Component handle)
-
hasNaturalId
public boolean hasNaturalId()
-
getDeclaredProperties
public List<Property> getDeclaredProperties()
- Specified by:
getDeclaredProperties
in interfaceIdentifiableTypeClass
-
addMappedSuperclassProperty
public void addMappedSuperclassProperty(Property p)
-
getSuperMappedSuperclass
public MappedSuperclass getSuperMappedSuperclass()
-
setSuperMappedSuperclass
public void setSuperMappedSuperclass(MappedSuperclass superMappedSuperclass)
-
assignCheckConstraintsToTable
public void assignCheckConstraintsToTable(Dialect dialect, TypeConfiguration types, SqmFunctionRegistry functions)
-
prepareForMappingModel
public void prepareForMappingModel(RuntimeModelCreationContext context)
-
addCheckConstraint
public void addCheckConstraint(CheckConstraint checkConstraint)
-
getCheckConstraints
public List<CheckConstraint> getCheckConstraints()
-
getImplicitTable
public Table getImplicitTable()
- Specified by:
getImplicitTable
in interfaceIdentifiableTypeClass
-
findTable
public Table findTable(String name)
- Specified by:
findTable
in interfaceTableContainer
-
getTable
public Table getTable(String name)
- Specified by:
getTable
in interfaceTableContainer
-
findSecondaryTable
public Join findSecondaryTable(String name)
- Specified by:
findSecondaryTable
in interfaceTableContainer
-
getSecondaryTable
public Join getSecondaryTable(String name)
- Specified by:
getSecondaryTable
in interfaceTableContainer
-
getSuperType
public IdentifiableTypeClass getSuperType()
- Specified by:
getSuperType
in interfaceIdentifiableTypeClass
-
getSubTypes
public List<IdentifiableTypeClass> getSubTypes()
- Specified by:
getSubTypes
in interfaceIdentifiableTypeClass
-
applyProperty
public void applyProperty(Property property)
- Specified by:
applyProperty
in interfaceIdentifiableTypeClass
-
isDefinedOnMultipleSubclasses
@Internal public boolean isDefinedOnMultipleSubclasses(Column column)
-
getSuperPersistentClass
@Internal public PersistentClass getSuperPersistentClass()
-
getInsertExpectation
public Supplier<? extends Expectation> getInsertExpectation()
-
setInsertExpectation
public void setInsertExpectation(Supplier<? extends Expectation> insertExpectation)
-
getUpdateExpectation
public Supplier<? extends Expectation> getUpdateExpectation()
-
setUpdateExpectation
public void setUpdateExpectation(Supplier<? extends Expectation> updateExpectation)
-
getDeleteExpectation
public Supplier<? extends Expectation> getDeleteExpectation()
-
setDeleteExpectation
public void setDeleteExpectation(Supplier<? extends Expectation> deleteExpectation)
-
-