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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The magic value ofDiscriminatorValue.value()
which indicates that the subclass is distinguished by any non-null value of the discriminator column.static final String
The 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 Object
void
addCallbackDefinitions
(List<CallbackDefinition> callbackDefinitions) void
addCheckConstraint
(CheckConstraint checkConstraint) void
addFilter
(String name, String condition, boolean autoAliasInjection, Map<String, String> aliasTableMap, Map<String, String> aliasEntityMap) void
void
void
addProperty
(Property property) Add a property to thisPersistentClass
orJoin
.void
addSubclass
(Subclass subclass) protected void
addSubclassJoin
(Join join) protected void
addSubclassProperty
(Property prop) protected void
addSubclassTable
(Table subclassTable) void
addSynchronizedTable
(String table) void
applyProperty
(Property property) void
assignCheckConstraintsToTable
(Dialect dialect, TypeConfiguration types) protected void
boolean
void
findSecondaryTable
(String name) int
abstract String
The name of the contributor which contributed thisabstract Property
abstract Property
Supplier<? extends Expectation>
abstract Value
abstract KeyValue
abstract Property
Supplier<? extends Expectation>
int
int
getJoinNumber
(Property prop) getJoins()
abstract KeyValue
getKey()
Class<?>
getMetaAttribute
(String name) abstract String
Build a list of the properties defined on this class.getProperty
(String propertyName) int
Class<?>
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 RootClass
abstract Table
getSecondaryTable
(String name) Get the subclasses in a special 'order', most derived subclasses first.abstract int
int
abstract PersistentClass
abstract Table
getTable()
Get a list of the properties defined on this class which are not defined as part of a join.Supplier<? extends Expectation>
abstract Property
abstract String
getWhere()
boolean
abstract boolean
boolean
abstract boolean
boolean
boolean
boolean
boolean
hasProperty
(String name) Check to see if this PersistentClass defines a property with the given name.boolean
boolean
boolean
boolean
isCached()
boolean
isClassOrSuperclassJoin
(Join join) boolean
isClassOrSuperclassTable
(Table closureTable) abstract boolean
boolean
boolean
boolean
boolean
isDefinedOnMultipleSubclasses
(Column column) abstract boolean
boolean
boolean
boolean
Deprecated.No longer supportedboolean
abstract boolean
abstract boolean
boolean
isLazy()
abstract boolean
abstract boolean
boolean
Check to see if a property with the given name exists in this PersistentClass or in any of its super hierarchy.boolean
Check to see if a property with the given name exists in the super hierarchy of this PersistentClass.abstract boolean
void
void
setAbstract
(Boolean isAbstract) void
setBatchSize
(int batchSize) void
setCached
(boolean cached) void
setClassName
(String className) void
setCustomSQLDelete
(String customSQLDelete, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) void
setCustomSQLInsert
(String customSQLInsert, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) void
setCustomSQLUpdate
(String customSQLUpdate, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) void
setDeclaredIdentifierMapper
(Component declaredIdentifierMapper) void
setDeleteExpectation
(Supplier<? extends Expectation> deleteExpectation) void
setDiscriminatorValue
(String discriminatorValue) void
setDynamicInsert
(boolean dynamicInsert) void
setDynamicUpdate
(boolean dynamicUpdate) void
setEntityName
(String entityName) void
setIdentifierMapper
(Component handle) void
setInsertExpectation
(Supplier<? extends Expectation> insertExpectation) void
setJpaEntityName
(String jpaEntityName) void
setLazy
(boolean lazy) void
setLoaderName
(String loaderName) void
setMetaAttributes
(Map<String, MetaAttribute> metas) void
setOptimisticLockStyle
(OptimisticLockStyle optimisticLockStyle) void
setProxyInterfaceName
(String proxyInterfaceName) void
setQueryCacheLayout
(CacheLayout queryCacheLayout) void
setSelectBeforeUpdate
(boolean selectBeforeUpdate) void
setSubselectLoadableCollections
(boolean hasSubselectCollections) void
setSuperMappedSuperclass
(MappedSuperclass superMappedSuperclass) void
setUpdateExpectation
(Supplier<? extends Expectation> updateExpectation) toString()
boolean
boolean
void
-
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:Contributable
The name of the contributor which contributed this- Specified by:
getContributor
in 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:AttributeContainer
Add a property to thisPersistentClass
orJoin
.- Specified by:
addProperty
in interfaceAttributeContainer
-
contains
- Specified by:
contains
in interfaceAttributeContainer
-
getTable
- Specified by:
getTable
in 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:
true
if a property with that name exists;false
if 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:
true
if a property with that name exists;false
if 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:
true
if a property with that name exists;false
if not
-
getOptimisticLockStyle
-
setOptimisticLockStyle
-
validate
- Throws:
MappingException
-
isDiscriminatorValueNotNull
public boolean isDiscriminatorValueNotNull() -
isDiscriminatorValueNull
public boolean isDiscriminatorValueNull() -
getMetaAttributes
- Specified by:
getMetaAttributes
in interfaceMetaAttributable
-
setMetaAttributes
- Specified by:
setMetaAttributes
in interfaceMetaAttributable
-
getMetaAttribute
- Specified by:
getMetaAttribute
in 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:
addFilter
in interfaceFilterable
-
getFilters
- Specified by:
getFilters
in 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:
getDeclaredProperties
in interfaceIdentifiableTypeClass
-
addMappedSuperclassProperty
-
getSuperMappedSuperclass
-
setSuperMappedSuperclass
-
assignCheckConstraintsToTable
-
prepareForMappingModel
-
addCheckConstraint
-
getCheckConstraints
-
getImplicitTable
- Specified by:
getImplicitTable
in interfaceIdentifiableTypeClass
-
findTable
- Specified by:
findTable
in interfaceTableContainer
-
getTable
- Specified by:
getTable
in interfaceTableContainer
-
findSecondaryTable
- Specified by:
findSecondaryTable
in interfaceTableContainer
-
getSecondaryTable
- Specified by:
getSecondaryTable
in interfaceTableContainer
-
getSuperType
- Specified by:
getSuperType
in interfaceIdentifiableTypeClass
-
getSubTypes
- Specified by:
getSubTypes
in interfaceIdentifiableTypeClass
-
applyProperty
- Specified by:
applyProperty
in interfaceIdentifiableTypeClass
-
isDefinedOnMultipleSubclasses
-
getSuperPersistentClass
-
getInsertExpectation
-
setInsertExpectation
-
getUpdateExpectation
-
setUpdateExpectation
-
getDeleteExpectation
-
setDeleteExpectation
-