Interface EntityPersister
- All Superinterfaces:
AttributeSource
,Bindable
,Discriminable
,EntityMappingType
,EntityMutationTarget
,EntityValuedModelPart
,FetchableContainer
,FilterRestrictable
,JdbcMappingContainer
,Loadable
,ManagedMappingType
,MappingModelExpressible
,MappingType
,ModelPart
,ModelPartContainer
,MutationTarget<EntityTableMapping>
,Restrictable
,RootTableGroupProducer
,SoftDeletableModelPart
,TableGroupProducer
,WhereRestrictable
- All Known Implementing Classes:
AbstractEntityPersister
,JoinedSubclassEntityPersister
,SingleTableEntityPersister
,UnionSubclassEntityPersister
EntityPersister
orchestrates rendering of the
SQL statements corresponding to basic lifecycle events, including
insert
, update
, and delete
statements, and their
execution via JDBC.
Concrete implementations of this interface handle the single table, joined, and union inheritance mapping strategies, and to a certain extent abstract the details of those mappings from collaborators.
This interface defines a contract between the persistence strategy and
the session
. It does
not define operations that are required for querying, nor for loading by
outer join.
Unless a custom PersisterFactory
is
used, it is expected that implementations of EntityPersister
define a constructor accepting the following arguments:
-
PersistentClass
- describes the metadata about the entity to be handled by the persister -
EntityDataAccess
- the second level caching strategy for this entity -
NaturalIdDataAccess
- the second level caching strategy for any natural id defined for this entity -
RuntimeModelCreationContext
- access to additional information useful while constructing the persister.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.Bindable
Bindable.JdbcValuesBiConsumer<X,
Y>, Bindable.JdbcValuesConsumer Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.EntityMappingType
EntityMappingType.ConstraintOrderedTableConsumer
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.ModelPart
ModelPart.JdbcValueBiConsumer<X,
Y>, ModelPart.JdbcValueConsumer -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault void
addToCacheKey
(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session) Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.void
afterInitialize
(Object entity, SharedSessionContractImplementor session) Called just after the entities properties have been initializedvoid
afterReassociate
(Object entity, SharedSessionContractImplementor session) Called just after the entity has been reassociated with the sessiondefault <X,
Y> int breakDownJdbcValues
(Object domainValue, int offset, X x, Y y, ModelPart.JdbcValueBiConsumer<X, Y> valueConsumer, SharedSessionContractImplementor session) Breaks down the domain value to its constituent JDBC values.buildCacheEntry
(Object entity, Object[] state, Object version, SharedSessionContractImplementor session) default boolean
Deprecated.This feature is no longer supportedboolean
boolean
boolean
int
createProxy
(Object id, SharedSessionContractImplementor session) Create a new proxy instancedefault void
delete
(Object id, Object version, Object object, SharedSessionContractImplementor session) Deprecated, for removal: This API element is subject to removal in a future version.int[]
findDirty
(Object[] currentState, Object[] previousState, Object owner, SharedSessionContractImplementor session) Compare the two snapshots to determine if they represent dirty state.int[]
findModified
(Object[] old, Object[] current, Object object, SharedSessionContractImplementor session) Compare the two snapshots to determine if they represent modified state.default Object
forceVersionIncrement
(Object id, Object currentVersion, boolean batching, SharedSessionContractImplementor session) forceVersionIncrement
(Object id, Object currentVersion, SharedSessionContractImplementor session) default AttributeMapping
getAttributeMapping
(int position) Retrieve an attribute mapping by position, relative to all attributesdefault int
The batch size for batch loading.default BytecodeEnhancementMetadata
Get the cache (optional operation)Get the cache structureClass<?>
Get the proxy interface that instances of this concrete class will be cast to (optional operation).String[][]
getCurrentVersion
(Object id, SharedSessionContractImplementor session) Get the current version of the object, or return null if there is no row for the given identifier.Object[]
getDatabaseSnapshot
(Object id, SharedSessionContractImplementor session) Get the current database state of the object, in a "hydrated" form, without resolving identifiers.Get the delete coordinator instance.getDiscriminatorAlias
(String suffix) Get the result set aliases used for the identifier columns, given a suffixDeprecated.UseSelectableMapping.getSelectionExpression()
insteadGet the discriminator typeGet the EntityEntryFactory indicated for the entity mapped by this persister.default EntityMappingType
The descriptor of the entity that is the type for this partRetrieve the underlying entity metamodel instance.The entity name which this persister maps.Return theSessionFactory
to which this persister belongs.getFilterAliasGenerator
(String rootAlias) default FilterAliasGenerator
getFilterAliasGenerator
(TableGroup rootTableGroup) getGeneratedProperties
(EventType timing) default Generator
getIdByUniqueKey
(Object key, String uniquePropertyName, SharedSessionContractImplementor session) default Object
getIdentifier
(Object entity) Get the identifier of an instance from the object's identifier property.getIdentifier
(Object entity, SharedSessionContractImplementor session) Get the identifier of an instance from the object's identifier property.default Object
getIdentifier
(Object entity, MergeContext mergeContext) Get the identifier of an instance from the object's identifier property.String[]
getIdentifierAliases
(String suffix) Get the result set aliases used for the identifier columns, given a suffixString[]
Get the names of columns used to persist the identifierDeprecated.usegetGenerator()
Get the name of the identifier property (or return null) - need not return the name of an actual Java propertyGet the identifier typeGet the database-specific SQL command to retrieve the last generated IDENTITY value.default String
Get the insert coordinator instance.@Nullable String
The JPA entity name, if one, associated with the entity.String[]
getKeyColumns
(int j) Class<?>
The persistent class, or nulldefault UpdateCoordinator
Get the merge coordinator instance.default MultiNaturalIdLoader<?>
Access to performing multi-value natural-id database selection.Get the NaturalId cache (optional operation)int[]
If the entity defines a natural id, that is, ifhasNaturalIdentifier()
returnstrue
, the indices of the properties which make up the natural id.Retrieve the current state of the natural-id properties from the database.default NaturalIdLoader<?>
Access to performing natural-id database selection.boolean[]
String[]
getPropertyAliases
(String suffix, int i) Get the result set aliases used for the property columns, given a suffix (properties of this class, only).Get the cascade styles of the properties (optional operation)boolean[]
Get the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated)String[]
getPropertyColumnNames
(String propertyPath) Get the column names for the given property pathboolean[]
Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT)boolean[]
String[]
Get the names of the class properties - doesn't have to be the names of the actual Java properties (used for XML generation only)boolean[]
Get the nullability of the properties of this classString[]
Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class only.getPropertyType
(String propertyName) Deprecated, for removal: This API element is subject to removal in a future version.Type[]
Get the Hibernate types of the class propertiesboolean[]
Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)getPropertyValue
(Object object, int i) Deprecated.UsegetValue(java.lang.Object, int)
insteadgetPropertyValue
(Object object, String propertyName) Get the value of a particular propertyObject[]
getPropertyValues
(Object object) Deprecated.UsegetValues(java.lang.Object)
insteadObject[]
getPropertyValuesToInsert
(Object object, Map<Object, Object> mergeMap, SharedSessionContractImplementor session) Return the values of the insertable properties of the object (including backrefs)boolean[]
Get the "versionability" of the properties of this class (is the property optimistic-locked)Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class and its subclasses.Describes how the entity is represented in the application's domain model.Returns an object that identifies the space in which identifiers of this entity hierarchy are unique.String[]
Get the names of columns on the root table used to persist the identifier.String[]
The names of the primary key columns in the root table.Locks are always applied to the "root table".getSelectByUniqueKeyString
(String propertyName) Get a SQL select string that performs a select based on a unique key determined by the given property name.default String
getSelectByUniqueKeyString
(String[] propertyNames) Get a SQL select string that performs a select based on a unique key determined by the given property names.getSelectByUniqueKeyString
(String[] propertyNames, String[] columnNames) default String
Get the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedThe strategy to use for SQM mutation statements where the target entity has multiple tables.getSubclassEntityPersister
(Object instance, SessionFactoryImplementor factory) Obtain theEntityPersister
for the concrete class of the given entity instance which participates in a mapped inheritance hierarchy with this persister.String[]
getSubclassPropertyColumnAliases
(String propertyName, String suffix) Return the column alias names used to persist/query the named property of the class or a subclass (optional operation).String[]
getSubclassTableName
(int j) int
default String[]
Deprecated, for removal: This API element is subject to removal in a future version.No longer calleddefault String[]
Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class and its subclasses.The table to join to.getTableName
(int j) Deprecated.Only ever used from places where we really want to useSelectStatement
(select generator)InsertSelectStatement
UpdateStatement
DeleteStatement
getTableNameForColumn
(String columnName) String[]
int
Retrieve the information needed to properly deal with this entity's discriminator in a query.Get the update coordinator instance.default Object
Extract a specific attribute value from the entity instance, by positiondefault Object[]
Extract the individual attribute values from the entity instancegetVersion
(Object object) Get the version number (or timestamp) from the object's version property.For versioned entities, get the name of the column (again, expected on the root table) used to store the version values.default BeforeExecutionGenerator
default VersionJavaType<Object>
int
IfisVersioned()
, then what is the index of the property holding the locking value.BasicType<?>
IfisVersioned()
, then what is the type of the property holding the locking value.boolean
hasCache()
Deprecated.UsecanReadFromCache()
and/orcanWriteToCache()
depending on needdefault boolean
Determine whether this entity has any delete cascading.boolean
Determine whether this entity has any (non-none) cascading.boolean
Determine whether this entity contains references to persistent collections not referencing the primary key.boolean
Determine whether this entity contains references to persistent collections.boolean
boolean
boolean
Determine whether the entity has a particular property holding the identifier value.boolean
Does this entity define any properties as being database generated on insert?boolean
Determine whether this entity defines any lazy properties (when bytecode instrumentation is enabled).boolean
boolean
Determine whether any properties of this entity are considered mutable.boolean
Does this class have a natural id cacheboolean
Determine whether this entity defines a natural identifier.default boolean
Determine whether this entity has any owned collections.boolean
hasProxy()
Determine whether this entity supports dynamic proxies.boolean
hasRowId()
Does the result set contain rowids?boolean
Determine whether this entity contains references to persistent collections which are fetchable by subselect?boolean
hasUninitializedLazyProperties
(Object object) Does the given instance have any uninitialized lazy properties?boolean
Does this entity define any properties as being database generated on update?default Object
initializeEnhancedEntityUsedAsProxy
(Object entity, String nameOfAttributeBeingAccessed, SharedSessionContractImplementor session) Called fromEnhancementAsProxyLazinessInterceptor
to trigger load of the entity's non-lazy state as well as the named attribute we are accessing if it is still uninitialized after fetching non-lazy state.default Object
insert
(Object[] fields, Object object, SharedSessionContractImplementor session) Deprecated, for removal: This API element is subject to removal in a future version.default void
insert
(Object id, Object[] fields, Object object, SharedSessionContractImplementor session) Deprecated, for removal: This API element is subject to removal in a future version.instantiate
(Object id, SharedSessionContractImplementor session) Create a class instance initialized with the given identifierdefault boolean
Is batch loading enabled?boolean
Should we always invalidate the cache instead of recaching updated stateboolean
Are identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.boolean
Determine whether the entity is inherited one or more other entities.boolean
isInstance
(Object object) Is the given object an instance of this entity?boolean
Has the class actually been bytecode instrumented?boolean
isInverseTable
(int j) boolean
Should lazy properties of this entity be cached?boolean
Determine whether instances of this entity are considered mutable.boolean
isNullableTable
(int j) default boolean
isPropertySelectable
(int propertyNumber) boolean
Is select snapshot before update enabled?boolean
isSharedColumn
(String columnExpression) boolean
isSubclassEntityName
(String entityName) Determine whether the given name represents a subclass entity (or this entity itself) of the entity mapped by this persister.isTransient
(Object object, SharedSessionContractImplementor session) Is this a new transient instance?boolean
Determine whether optimistic locking by column is enabled for this entity.boolean
Does this entity contain a version property that is defined to be database generated?load
(Object id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session) Load an instance of the persistent class.default Object
load
(Object id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session, Boolean readOnly) Deprecated.load
(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session) Load an instance of the persistent class.default Object
load
(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session, Boolean readOnly) default Object
loadByUniqueKey
(String propertyName, Object uniqueKey, SharedSessionContractImplementor session) Load an instance of the persistent class, by a unique key other than the primary key.loadEntityIdByNaturalId
(Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session) Load the id for the entity based on the natural id.void
Do a version check (optional operation)void
lock
(Object id, Object version, Object object, LockOptions lockOptions, EventSource session) Do a version check (optional operation)boolean
managesColumns
(String[] columnNames) default void
merge
(Object id, Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object object, Object rowId, SharedSessionContractImplementor session) Deprecated, for removal: This API element is subject to removal in a future version.List<?>
multiLoad
(Object[] ids, EventSource session, MultiIdLoadOptions loadOptions) Performs a load of multiple entities (of this type) by identifier simultaneously.void
Finish the initialization of this object.default void
Prepare loaders associated with the persister.default void
processInsertGeneratedProperties
(Object id, Object entity, Object[] state, SharedSessionContractImplementor session) Deprecated, for removal: This API element is subject to removal in a future version.default void
processInsertGeneratedProperties
(Object id, Object entity, Object[] state, GeneratedValues generatedValues, SharedSessionContractImplementor session) Retrieve the values of any insert generated properties through the providedGeneratedValues
or, when that's not available, by selecting them back from the database, injecting these generated values into the given entity as well as writing this state to thePersistenceContext
.default void
processUpdateGeneratedProperties
(Object id, Object entity, Object[] state, SharedSessionContractImplementor session) Deprecated, for removal: This API element is subject to removal in a future version.void
processUpdateGeneratedProperties
(Object id, Object entity, Object[] state, GeneratedValues generatedValues, SharedSessionContractImplementor session) Retrieve the values of any update generated properties through the providedGeneratedValues
or, when that's not available, by selecting them back from the database, injecting these generated values into the given entity as well as writing this state to thePersistenceContext
.void
resetIdentifier
(Object entity, Object currentId, Object currentVersion, SharedSessionContractImplementor session) Set the identifier and version of the given instance back to its "unsaved" value, that is, the value it had before it was made persistent.int[]
resolveAttributeIndexes
(String[] attributeNames) Converts an array of attribute names to a set of indexes, according to the entity metamodeldefault int[]
resolveDirtyAttributeIndexes
(Object[] values, Object[] loadedState, String[] attributeNames, SessionImplementor session) LikeresolveAttributeIndexes(String[])
but also always returns mutable attributesselectFragment
(String alias, String suffix) All columns to select, when loading.void
setIdentifier
(Object entity, Object id, SharedSessionContractImplementor session) Inject the identifier value into the given entity.void
setPropertyValue
(Object object, int i, Object value) Deprecated.void
setPropertyValues
(Object object, Object[] values) Deprecated.UsesetValues(java.lang.Object, java.lang.Object[])
insteaddefault void
Inject a specific attribute value into the entity instance, by positiondefault void
Inject the attribute values into the entity instanceboolean
String[]
Deprecated, for removal: This API element is subject to removal in a future version.No longer used in ORM coredefault void
update
(Object id, Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object object, Object rowId, SharedSessionContractImplementor session) Deprecated, for removal: This API element is subject to removal in a future version.boolean
default void
visitQuerySpaces
(Consumer<String> querySpaceConsumer) Visit each "query space" for the mapped entity.Methods inherited from interface org.hibernate.persister.walking.spi.AttributeSource
getPropertyIndex
Methods inherited from interface org.hibernate.metamodel.mapping.Bindable
forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachJdbcValue, forEachJdbcValue
Methods inherited from interface org.hibernate.metamodel.mapping.EntityMappingType
applyBaseRestrictions, applyDiscriminator, applyFilterRestrictions, applyWhereRestrictions, asEntityMappingType, createPrimaryTableReference, createRootTableGroup, createTableReferenceJoin, extractConcreteTypeStateValues, findContainingEntityMapping, findDeclaredAttributeMapping, findSubPart, findSubTypesSubPart, forEachAttributeMapping, getAttributeMappings, getContributor, getDeclaredAttributeMappings, getDiscriminatorMapping, getDiscriminatorSQLValue, getDiscriminatorValue, getEntityPersister, getFetchable, getIdentifierMapping, getIdentifierMappingForJoin, getIdentifierTableDetails, getJavaType, getJdbcTypeCount, getMappedJavaType, getMappedSuperclass, getMappedTableDetails, getNaturalIdMapping, getNumberOfAttributeMappings, getNumberOfDeclaredAttributeMappings, getNumberOfFetchables, getPartMappingType, getPartName, getRootEntityDescriptor, getRootPathName, getRowIdMapping, getSoftDeleteMapping, getSoftDeleteTableDetails, getSubclassEntityNames, getSubclassId, getSubMappingTypes, getSuperMappingType, getVersionMapping, hasSubclasses, hasWhereRestrictions, isAbstract, isAffectedByEnabledFetchProfiles, isAffectedByEnabledFilters, isAffectedByEntityGraph, isConcreteProxy, isExplicitPolymorphism, isTypeOrSuperType, isTypeOrSuperType, optimisticLockStyle, pruneForSubclasses, resolveConcreteProxyTypeForId, visitAttributeMappings, visitConstraintOrderedTables, visitDeclaredAttributeMappings, visitSubTypeAttributeMappings, visitSuperTypeAttributeMappings
Methods inherited from interface org.hibernate.persister.entity.mutation.EntityMutationTarget
addDiscriminatorToInsertGroup, addSoftDeleteToInsertGroup, getAttributeMutationTableName, getIdentifierDescriptor, getIdentifierTableMapping, getIdentityInsertDelegate, getInsertDelegate, getMutationDelegate, getTableMappings, getTargetPart, getUpdateDelegate, physicalTableNameForMutation
Methods inherited from interface org.hibernate.metamodel.mapping.EntityValuedModelPart
applySqlSelections, applySqlSelections, createDomainResult, disassemble, findSubPart, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachSubPart, visitSubParts
Methods inherited from interface org.hibernate.sql.results.graph.FetchableContainer
getKeyFetchable, getNumberOfFetchableKeys, getNumberOfKeyFetchables, getSelectableIndex, visitFetchables, visitFetchables, visitFetchables, visitKeyFetchables, visitKeyFetchables, visitKeyFetchables
Methods inherited from interface org.hibernate.metamodel.mapping.FilterRestrictable
applyFilterRestrictions
Methods inherited from interface org.hibernate.metamodel.mapping.JdbcMappingContainer
getJdbcMapping, getSingleJdbcMapping
Methods inherited from interface org.hibernate.loader.ast.spi.Loadable
isAffectedByEnabledFilters, isAffectedByInfluencers, isAffectedByInfluencers, isNotAffectedByInfluencers
Methods inherited from interface org.hibernate.metamodel.mapping.ManagedMappingType
anyRequiresAggregateColumnWriter, findAttributeMapping, forEachAttributeMapping, hasPartitionedSelectionMapping, isAffectedByEnabledFilters
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
areEqual, asAttributeMapping, asBasicValuedModelPart, breakDownJdbcValues, decompose, decompose, forEachSelectable, forEachSelectable, getNavigableRole, isEntityIdentifierMapping, isVirtual
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPartContainer
findByPath, findByPath, forEachSubPart
Methods inherited from interface org.hibernate.sql.model.MutationTarget
forEachMutableTable, forEachMutableTableReverse, getIdentifierTableName, getNavigableRole, getRolePath
Methods inherited from interface org.hibernate.metamodel.mapping.Restrictable
applyBaseRestrictions
Methods inherited from interface org.hibernate.sql.ast.tree.from.TableGroupProducer
containsTableReference
-
Field Details
-
ENTITY_ID
Deprecated.this feature of HQL is now deprecatedThe property name of the "special" identifier property in HQL- See Also:
-
-
Method Details
-
postInstantiate
Finish the initialization of this object.The method
InFlightEntityMappingType.prepareMappingModel(org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess)
must have been called for every entity persister before this method is invoked.Called only once per
SessionFactory
lifecycle, after all entity persisters have been instantiated.- Throws:
MappingException
- Indicates an issue in the metadata.
-
prepareLoaders
default void prepareLoaders()Prepare loaders associated with the persister. Distinct "phase" in building the persister after InFlightEntityMappingType.prepareMappingModel(org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess) and postInstantiate() have occurred. The distinct phase is used to ensure that all TableDetails are available across the entire model -
getFactory
SessionFactoryImplementor getFactory()Return theSessionFactory
to which this persister belongs.- Returns:
- The owning
SessionFactory
.
-
getSqlAliasStem
Description copied from interface:TableGroupProducer
Get the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedNote that this is a metadata-ive value. It is only ever used internal to the producer producing its TableGroup.
- Specified by:
getSqlAliasStem
in interfaceEntityMappingType
- Specified by:
getSqlAliasStem
in interfaceTableGroupProducer
- See Also:
-
getEntityEntryFactory
EntityEntryFactory getEntityEntryFactory()Get the EntityEntryFactory indicated for the entity mapped by this persister.- Returns:
- The proper EntityEntryFactory.
-
getRootEntityName
String getRootEntityName()Returns an object that identifies the space in which identifiers of this entity hierarchy are unique. Might be a table name, a JNDI URL, etc.- Returns:
- The root entity name.
-
getEntityName
String getEntityName()The entity name which this persister maps.- Specified by:
getEntityName
in interfaceEntityMappingType
- Returns:
- The name of the entity which this persister maps.
-
getJpaEntityName
@Nullable String getJpaEntityName()The JPA entity name, if one, associated with the entity. -
getImportedName
- Specified by:
getImportedName
in interfaceEntityMappingType
-
getSqmMultiTableMutationStrategy
SqmMultiTableMutationStrategy getSqmMultiTableMutationStrategy()The strategy to use for SQM mutation statements where the target entity has multiple tables. Returnsnull
to indicate that the entity does not have multiple tables.- Specified by:
getSqmMultiTableMutationStrategy
in interfaceEntityMappingType
-
getSqmMultiTableInsertStrategy
SqmMultiTableInsertStrategy getSqmMultiTableInsertStrategy()- Specified by:
getSqmMultiTableInsertStrategy
in interfaceEntityMappingType
-
getEntityMetamodel
EntityMetamodel getEntityMetamodel()Retrieve the underlying entity metamodel instance.- Returns:
- The metamodel
-
isSubclassEntityName
Determine whether the given name represents a subclass entity (or this entity itself) of the entity mapped by this persister.- Parameters:
entityName
- The entity name to be checked.- Returns:
- True if the given entity name represents either the entity mapped by this persister or one of its subclass entities; false otherwise.
-
getPropertySpaces
String[] getPropertySpaces()Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class only.For most implementations, this returns the complete set of table names to which instances of the mapped entity are persisted (not accounting for superclass entity mappings).
- Returns:
- The property spaces.
-
getQuerySpaces
Serializable[] getQuerySpaces()Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class and its subclasses.Much like
getPropertySpaces()
, except that here we include subclass entity spaces.- Returns:
- The query spaces.
-
getSynchronizationSpaces
Deprecated, for removal: This API element is subject to removal in a future version.No longer calledThe table names this entity needs to be synchronized against.Much like
getPropertySpaces()
, except that here we include subclass entity spaces.- Returns:
- The synchronization spaces.
-
getSynchronizedQuerySpaces
Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class and its subclasses.Much like
getPropertySpaces()
, except that here we include subclass entity spaces.- Returns:
- The query spaces.
-
visitQuerySpaces
Description copied from interface:EntityMappingType
Visit each "query space" for the mapped entity.- Specified by:
visitQuerySpaces
in interfaceEntityMappingType
-
hasProxy
boolean hasProxy()Determine whether this entity supports dynamic proxies.- Returns:
- True if the entity has dynamic proxy support; false otherwise.
-
hasCollections
boolean hasCollections()Determine whether this entity contains references to persistent collections.- Returns:
- True if the entity does contain persistent collections; false otherwise.
-
hasMutableProperties
boolean hasMutableProperties()Determine whether any properties of this entity are considered mutable.- Returns:
- True if any properties of the entity are mutable; false otherwise (meaning none are).
-
hasSubselectLoadableCollections
boolean hasSubselectLoadableCollections()Determine whether this entity contains references to persistent collections which are fetchable by subselect?- Returns:
- True if the entity contains collections fetchable by subselect; false otherwise.
-
hasCollectionNotReferencingPK
boolean hasCollectionNotReferencingPK()Determine whether this entity contains references to persistent collections not referencing the primary key.- Returns:
- True if the entity contains a collection not referencing the primary key; false otherwise.
- Since:
- 6.2
-
hasCascades
boolean hasCascades()Determine whether this entity has any (non-none) cascading.- Returns:
- True if the entity has any properties with a cascade other than NONE; false otherwise (aka, no cascading).
-
hasCascadeDelete
default boolean hasCascadeDelete()Determine whether this entity has any delete cascading.- Returns:
- True if the entity has any properties with a cascade other than NONE; false otherwise.
-
hasOwnedCollections
default boolean hasOwnedCollections()Determine whether this entity has any owned collections.- Returns:
- True if the entity has an owned collection; false otherwise.
-
isMutable
boolean isMutable()Determine whether instances of this entity are considered mutable.- Returns:
- True if the entity is considered mutable; false otherwise.
-
isInherited
boolean isInherited()Determine whether the entity is inherited one or more other entities. In other words, is this entity a subclass of other entities.- Returns:
- True if other entities extend this entity; false otherwise.
-
isIdentifierAssignedByInsert
boolean isIdentifierAssignedByInsert()Are identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.- Returns:
- True if identifiers for this entity are generated by the insert execution.
-
getPropertyType
@Deprecated(since="6", forRemoval=true) Type getPropertyType(String propertyName) throws MappingException Deprecated, for removal: This API element is subject to removal in a future version.Get the type of a particular property by name.- Parameters:
propertyName
- The name of the property for which to retrieve the type.- Returns:
- The type.
- Throws:
MappingException
- Typically indicates an unknown property name.
-
hasIdentifierProperty
boolean hasIdentifierProperty()Determine whether the entity has a particular property holding the identifier value.- Returns:
- True if the entity has a specific property holding identifier value.
-
canExtractIdOutOfEntity
Deprecated.This feature is no longer supportedDetermine whether detached instances of this entity carry their own identifier value.The other option is the deprecated feature where users could supply the id during session calls.
- Returns:
- True if either (1)
hasIdentifierProperty()
or (2) the identifier is an embedded composite identifier; false otherwise.
-
isVersioned
boolean isVersioned()Determine whether optimistic locking by column is enabled for this entity.- Returns:
- True if optimistic locking by column (i.e.,
<version/>
or<timestamp/>
) is enabled; false otherwise.
-
getVersionType
BasicType<?> getVersionType()IfisVersioned()
, then what is the type of the property holding the locking value.- Returns:
- The type of the version property; or null, if not versioned.
-
getVersionJavaType
-
getVersionProperty
int getVersionProperty()IfisVersioned()
, then what is the index of the property holding the locking value.- Returns:
- The type of the version property; or -66, if not versioned.
-
hasNaturalIdentifier
boolean hasNaturalIdentifier()Determine whether this entity defines a natural identifier.- Returns:
- True if the entity defines a natural id; false otherwise.
-
getNaturalIdentifierProperties
int[] getNaturalIdentifierProperties()If the entity defines a natural id, that is, ifhasNaturalIdentifier()
returnstrue
, the indices of the properties which make up the natural id.- Returns:
- The indices of the properties making up the natural id; or null, if no natural id is defined.
-
getIdentifierGenerator
Deprecated.usegetGenerator()
Determine which identifier generation strategy is used for this entity.- Returns:
- The identifier generation strategy.
-
getGenerator
-
getVersionGenerator
-
getAttributeMapping
Description copied from interface:EntityMappingType
Retrieve an attribute mapping by position, relative to all attributes- Specified by:
getAttributeMapping
in interfaceEntityMappingType
- Specified by:
getAttributeMapping
in interfaceManagedMappingType
-
hasLazyProperties
boolean hasLazyProperties()Determine whether this entity defines any lazy properties (when bytecode instrumentation is enabled).- Returns:
- True if the entity has properties mapped as lazy; false otherwise.
-
getNaturalIdLoader
Description copied from interface:EntityMappingType
Access to performing natural-id database selection. This is per-entity in the hierarchy- Specified by:
getNaturalIdLoader
in interfaceEntityMappingType
-
getMultiNaturalIdLoader
Description copied from interface:EntityMappingType
Access to performing multi-value natural-id database selection. This is per-entity in the hierarchy- Specified by:
getMultiNaturalIdLoader
in interfaceEntityMappingType
-
multiLoad
Performs a load of multiple entities (of this type) by identifier simultaneously.- Parameters:
ids
- The identifiers to loadsession
- The originating SessionloadOptions
- The options for loading- Returns:
- The loaded, matching entities
-
lock
Do a version check (optional operation) -
lock
Do a version check (optional operation) -
getInsertCoordinator
InsertCoordinator getInsertCoordinator()Get the insert coordinator instance.- Since:
- 6.5
-
getUpdateCoordinator
UpdateCoordinator getUpdateCoordinator()Get the update coordinator instance.- Since:
- 6.5
-
getDeleteCoordinator
DeleteCoordinator getDeleteCoordinator()Get the delete coordinator instance.- Since:
- 6.5
-
getMergeCoordinator
Get the merge coordinator instance.- Since:
- 6.5
-
getPropertyTypes
Type[] getPropertyTypes()Get the Hibernate types of the class properties -
getPropertyNames
String[] getPropertyNames()Get the names of the class properties - doesn't have to be the names of the actual Java properties (used for XML generation only) -
getPropertyInsertability
boolean[] getPropertyInsertability()Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT) -
getPropertyUpdateability
boolean[] getPropertyUpdateability()Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE) -
getPropertyCheckability
boolean[] getPropertyCheckability()Get the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated) -
getPropertyNullability
boolean[] getPropertyNullability()Get the nullability of the properties of this class -
getPropertyVersionability
boolean[] getPropertyVersionability()Get the "versionability" of the properties of this class (is the property optimistic-locked) -
getPropertyLaziness
boolean[] getPropertyLaziness() -
getNonLazyPropertyUpdateability
boolean[] getNonLazyPropertyUpdateability() -
getPropertyCascadeStyles
CascadeStyle[] getPropertyCascadeStyles()Get the cascade styles of the properties (optional operation) -
isPropertySelectable
default boolean isPropertySelectable(int propertyNumber) -
getIdentifierType
Type getIdentifierType()Get the identifier type -
getIdentifierPropertyName
String getIdentifierPropertyName()Get the name of the identifier property (or return null) - need not return the name of an actual Java property -
isCacheInvalidationRequired
boolean isCacheInvalidationRequired()Should we always invalidate the cache instead of recaching updated state -
isLazyPropertiesCacheable
boolean isLazyPropertiesCacheable()Should lazy properties of this entity be cached? -
canReadFromCache
boolean canReadFromCache() -
canWriteToCache
boolean canWriteToCache() -
hasCache
Deprecated.UsecanReadFromCache()
and/orcanWriteToCache()
depending on needDoes this class have a cache. -
getCacheAccessStrategy
EntityDataAccess getCacheAccessStrategy()Get the cache (optional operation) -
getCacheEntryStructure
CacheEntryStructure getCacheEntryStructure()Get the cache structure -
hasNaturalIdCache
boolean hasNaturalIdCache()Does this class have a natural id cache -
getNaturalIdCacheAccessStrategy
NaturalIdDataAccess getNaturalIdCacheAccessStrategy()Get the NaturalId cache (optional operation) -
getBatchSize
default int getBatchSize()The batch size for batch loading.- Specified by:
getBatchSize
in interfaceLoadable
- See Also:
-
isBatchLoadable
default boolean isBatchLoadable()Is batch loading enabled? -
isSelectBeforeUpdateRequired
boolean isSelectBeforeUpdateRequired()Is select snapshot before update enabled? -
isInstrumented
boolean isInstrumented()Has the class actually been bytecode instrumented? -
hasInsertGeneratedProperties
boolean hasInsertGeneratedProperties()Does this entity define any properties as being database generated on insert?- Returns:
- True if this entity contains at least one property defined as generated (including version property, but not identifier).
-
hasUpdateGeneratedProperties
boolean hasUpdateGeneratedProperties()Does this entity define any properties as being database generated on update?- Returns:
- True if this entity contains at least one property defined as generated (including version property, but not identifier).
-
isVersionPropertyGenerated
boolean isVersionPropertyGenerated()Does this entity contain a version property that is defined to be database generated?- Returns:
- true if this entity contains a version property and that property has been marked as generated.
-
getGeneratedProperties
-
getInsertGeneratedProperties
-
getUpdateGeneratedProperties
-
getMappedClass
Class<?> getMappedClass()The persistent class, or null -
getConcreteProxyClass
Class<?> getConcreteProxyClass()Get the proxy interface that instances of this concrete class will be cast to (optional operation). -
setValues
Description copied from interface:ManagedMappingType
Inject the attribute values into the entity instance- Specified by:
setValues
in interfaceManagedMappingType
-
setPropertyValues
Deprecated.UsesetValues(java.lang.Object, java.lang.Object[])
insteadSet the given values to the mapped properties of the given object. -
setValue
Description copied from interface:ManagedMappingType
Inject a specific attribute value into the entity instance, by position- Specified by:
setValue
in interfaceManagedMappingType
-
setPropertyValue
Deprecated.Set the value of a particular property of the given instance. -
getValues
Description copied from interface:ManagedMappingType
Extract the individual attribute values from the entity instance- Specified by:
getValues
in interfaceManagedMappingType
-
getPropertyValues
Deprecated.UsegetValues(java.lang.Object)
instead -
getValue
Description copied from interface:ManagedMappingType
Extract a specific attribute value from the entity instance, by position- Specified by:
getValue
in interfaceManagedMappingType
-
getPropertyValue
Deprecated.UsegetValue(java.lang.Object, int)
instead- Throws:
HibernateException
-
getPropertyValue
Get the value of a particular property -
getIdentifier
Get the identifier of an instance from the object's identifier property. Throw an exception if it has no identifier property. It's supposed to be use during the merging process -
getIdentifier
Get the identifier of an instance from the object's identifier property. Throw an exception if it has no identifier property. -
getVersion
Get the version number (or timestamp) from the object's version property. Returnnull
if it is not versioned.- Throws:
HibernateException
-
isInstance
Is the given object an instance of this entity? -
hasUninitializedLazyProperties
Does the given instance have any uninitialized lazy properties? -
getSubclassEntityPersister
Obtain theEntityPersister
for the concrete class of the given entity instance which participates in a mapped inheritance hierarchy with this persister. The given instance must be an instance of a subclass of the persistent class managed by this persister.A request has already identified the entity name of this persister as the mapping for the given instance. However, we still need to account for possible subclassing and potentially reroute to the more appropriate persister.
For example, a request names
Animal
as the entity name which gets resolved to this persister. But the actual instance is really an instance ofCat
which is a subclass ofAnimal
. So, here theAnimal
persister is being asked to return the persister specific toCat
.It's also possible that the instance is actually an
Animal
instance in the above example in which case we would returnthis
from this method.- Parameters:
instance
- The entity instancefactory
- Reference to the SessionFactory- Returns:
- The appropriate persister
- Throws:
HibernateException
- Indicates that instance was deemed to not be a subclass of the entity mapped by this persister.
-
getRepresentationStrategy
EntityRepresentationStrategy getRepresentationStrategy()Description copied from interface:EntityMappingType
Describes how the entity is represented in the application's domain model.- Specified by:
getRepresentationStrategy
in interfaceEntityMappingType
-
getEntityMappingType
Description copied from interface:EntityValuedModelPart
The descriptor of the entity that is the type for this part- Specified by:
getEntityMappingType
in interfaceEntityValuedModelPart
-
getInstrumentationMetadata
BytecodeEnhancementMetadata getInstrumentationMetadata() -
getBytecodeEnhancementMetadata
-
getFilterAliasGenerator
-
getFilterAliasGenerator
-
getTableName
String getTableName()The table to join to. -
resolveAttributeIndexes
Converts an array of attribute names to a set of indexes, according to the entity metamodel- Parameters:
attributeNames
- Array of names to be resolved- Returns:
- A set of unique indexes of the attribute names found in the metamodel
-
resolveDirtyAttributeIndexes
default int[] resolveDirtyAttributeIndexes(Object[] values, Object[] loadedState, String[] attributeNames, SessionImplementor session) LikeresolveAttributeIndexes(String[])
but also always returns mutable attributes- Parameters:
attributeNames
- Array of names to be resolved- Returns:
- A set of unique indexes of the attribute names found in the metamodel
-
canUseReferenceCacheEntries
boolean canUseReferenceCacheEntries() -
useShallowQueryCacheLayout
-
storeDiscriminatorInShallowQueryCacheLayout
-
hasFilterForLoadByKey
boolean hasFilterForLoadByKey() -
uniqueKeyEntries
- Returns:
- Metadata for each unique key defined
-
getSelectByUniqueKeyString
Get a SQL select string that performs a select based on a unique key determined by the given property name.- Parameters:
propertyName
- The name of the property which maps to the column(s) to use in the select statement restriction.- Returns:
- The SQL select string
-
getSelectByUniqueKeyString
Get a SQL select string that performs a select based on a unique key determined by the given property names.- Parameters:
propertyNames
- The names of the properties which maps to the column(s) to use in the select statement restriction.- Returns:
- The SQL select string
-
getSelectByUniqueKeyString
-
getRootTableKeyColumnNames
String[] getRootTableKeyColumnNames()The names of the primary key columns in the root table.- Returns:
- The primary key column names.
-
getIdentitySelectString
String getIdentitySelectString()Get the database-specific SQL command to retrieve the last generated IDENTITY value.- Returns:
- The SQL command string
-
getIdentifierColumnNames
String[] getIdentifierColumnNames()Get the names of columns used to persist the identifier -
getIdentifierAliases
Get the result set aliases used for the identifier columns, given a suffix -
getRootTableName
String getRootTableName()Locks are always applied to the "root table".- Returns:
- The root table name
-
getRootTableIdentifierColumnNames
String[] getRootTableIdentifierColumnNames()Get the names of columns on the root table used to persist the identifier.- Returns:
- The root table identifier column names.
-
getVersionColumnName
String getVersionColumnName()For versioned entities, get the name of the column (again, expected on the root table) used to store the version values.- Returns:
- The version column name.
-
getPropertyAliases
Get the result set aliases used for the property columns, given a suffix (properties of this class, only). -
getDiscriminatorAlias
Get the result set aliases used for the identifier columns, given a suffix -
hasMultipleTables
boolean hasMultipleTables() -
getTableNames
String[] getTableNames() -
getTableName
Deprecated.Only ever used from places where we really want to useSelectStatement
(select generator)InsertSelectStatement
UpdateStatement
DeleteStatement
-
getKeyColumns
-
getTableSpan
int getTableSpan() -
isInverseTable
boolean isInverseTable(int j) -
isNullableTable
boolean isNullableTable(int j) -
hasDuplicateTables
boolean hasDuplicateTables() -
getSubclassTableSpan
int getSubclassTableSpan() -
getSubclassTableName
-
getTableNameForColumn
-
getDiscriminatorColumnName
Deprecated.UseSelectableMapping.getSelectionExpression()
instead- Returns:
- the column name for the discriminator as specified in the mapping.
-
getDiscriminatorType
Type getDiscriminatorType()Get the discriminator type -
hasRowId
boolean hasRowId()Does the result set contain rowids? -
getSubclassPropertyColumnNames
-
getSubclassPropertyColumnAliases
Return the column alias names used to persist/query the named property of the class or a subclass (optional operation). -
countSubclassProperties
int countSubclassProperties() -
getPropertyColumnNames
Get the column names for the given property path -
selectFragment
All columns to select, when loading. -
getTypeDiscriminatorMetadata
DiscriminatorMetadata getTypeDiscriminatorMetadata()Retrieve the information needed to properly deal with this entity's discriminator in a query.- Returns:
- The entity discriminator metadata
-
toColumns
Deprecated, for removal: This API element is subject to removal in a future version.No longer used in ORM coreGiven a property path, return the corresponding column name(s). -
getConstraintOrderedTableKeyColumnClosure
String[][] getConstraintOrderedTableKeyColumnClosure() -
managesColumns
-