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 Subinterfaces:
DeprecatedEntityStuff,Loadable,Lockable,OuterJoinLoadable,PostInsertIdentityPersister,Queryable,SQLLoadable,UniqueKeyLoadable
- All Known Implementing Classes:
AbstractEntityPersister,JoinedSubclassEntityPersister,SingleTableEntityPersister,UnionSubclassEntityPersister
public interface EntityPersister extends EntityMappingType, EntityMutationTarget, RootTableGroupProducer, AttributeSource
A strategy for persisting a mapped entity class. AnEntityPersisterorchestrates rendering of the SQL statements corresponding to basic lifecycle events, includinginsert,update, anddeletestatements, 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
PersisterFactoryis used, it is expected that implementations ofEntityPersisterdefine 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:
PersisterFactory,PersisterClassResolver
-
-
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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default voidaddToCacheKey(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session)Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.voidafterInitialize(Object entity, SharedSessionContractImplementor session)Called just after the entities properties have been initializedvoidafterReassociate(Object entity, SharedSessionContractImplementor session)Called just after the entity has been reassociated with the sessiondefault <X,Y>
intbreakDownJdbcValues(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.CacheEntrybuildCacheEntry(Object entity, Object[] state, Object version, SharedSessionContractImplementor session)default booleancanExtractIdOutOfEntity()Deprecated.This feature is no longer supportedbooleancanReadFromCache()booleancanUseReferenceCacheEntries()booleancanWriteToCache()ObjectcreateProxy(Object id, SharedSessionContractImplementor session)Create a new proxy instancedefault voiddelete(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 ObjectforceVersionIncrement(Object id, Object currentVersion, boolean batching, SharedSessionContractImplementor session)ObjectforceVersionIncrement(Object id, Object currentVersion, SharedSessionContractImplementor session)default AttributeMappinggetAttributeMapping(int position)Retrieve an attribute mapping by position, relative to all attributesdefault intgetBatchSize()The batch size for batch loading.default BytecodeEnhancementMetadatagetBytecodeEnhancementMetadata()EntityDataAccessgetCacheAccessStrategy()Get the cache (optional operation)CacheEntryStructuregetCacheEntryStructure()Get the cache structureClassMetadatagetClassMetadata()Deprecated.This operation is no longer called by Hibernate.Class<?>getConcreteProxyClass()Get the proxy interface that instances of this concrete class will be cast to (optional operation).ObjectgetCurrentVersion(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.DeleteCoordinatorgetDeleteCoordinator()Get the delete coordinator instance.EntityEntryFactorygetEntityEntryFactory()Get the EntityEntryFactory indicated for the entity mapped by this persister.default EntityMappingTypegetEntityMappingType()The descriptor of the entity that is the type for this partEntityMetamodelgetEntityMetamodel()Retrieve the underlying entity metamodel instance.StringgetEntityName()The entity name which this persister maps.SessionFactoryImplementorgetFactory()Return theSessionFactoryto which this persister belongs.org.hibernate.internal.FilterAliasGeneratorgetFilterAliasGenerator(String rootAlias)default org.hibernate.internal.FilterAliasGeneratorgetFilterAliasGenerator(TableGroup rootTableGroup)default List<? extends ModelPart>getGeneratedProperties(EventType timing)default GeneratorgetGenerator()ObjectgetIdByUniqueKey(Object key, String uniquePropertyName, SharedSessionContractImplementor session)ObjectgetIdentifier(Object entity, SharedSessionContractImplementor session)Get the identifier of an instance from the object's identifier property.default ObjectgetIdentifier(Object entity, MergeContext mergeContext)Get the identifier of an instance from the object's identifier property.String[]getIdentifierColumnNames()IdentifierGeneratorgetIdentifierGenerator()Deprecated.usegetGenerator()StringgetIdentifierPropertyName()Get the name of the identifier property (or return null) - need not return the name of an actual Java propertyTypegetIdentifierType()Get the identifier typeStringgetIdentitySelectString()Get the database-specific SQL command to retrieve the last generated IDENTITY value.InsertCoordinatorgetInsertCoordinator()Get the insert coordinator instance.default List<? extends ModelPart>getInsertGeneratedProperties()BytecodeEnhancementMetadatagetInstrumentationMetadata()Class<?>getMappedClass()The persistent class, or nulldefault UpdateCoordinatorgetMergeCoordinator()Get the merge coordinator instance.default MultiNaturalIdLoader<?>getMultiNaturalIdLoader()Access to performing multi-value natural-id database selection.NaturalIdDataAccessgetNaturalIdCacheAccessStrategy()Get the NaturalId cache (optional operation)int[]getNaturalIdentifierProperties()If the entity defines a natural id, that is, ifhasNaturalIdentifier()returnstrue, the indices of the properties which make up the natural id.ObjectgetNaturalIdentifierSnapshot(Object id, SharedSessionContractImplementor session)Retrieve the current state of the natural-id properties from the database.default NaturalIdLoader<?>getNaturalIdLoader()Access to performing natural-id database selection.CascadeStyle[]getPropertyCascadeStyles()Get the cascade styles of the properties (optional operation)boolean[]getPropertyCheckability()Get the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated)boolean[]getPropertyInsertability()Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT)boolean[]getPropertyLaziness()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)boolean[]getPropertyNullability()Get the nullability of the properties of this classString[]getPropertySpaces()Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class only.TypegetPropertyType(String propertyName)Deprecated, for removal: This API element is subject to removal in a future version.Type[]getPropertyTypes()Get the Hibernate types of the class propertiesboolean[]getPropertyUpdateability()Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)ObjectgetPropertyValue(Object object, int i)Deprecated.UsegetValue(java.lang.Object, int)insteadObjectgetPropertyValue(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[]getPropertyVersionability()Get the "versionability" of the properties of this class (is the property optimistic-locked)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.EntityRepresentationStrategygetRepresentationStrategy()Describes how the entity is represented in the application's domain model.StringgetRootEntityName()Returns an object that identifies the space in which identifiers of this entity hierarchy are unique.String[]getRootTableKeyColumnNames()The names of the primary key columns in the root table.StringgetSelectByUniqueKeyString(String propertyName)Get a SQL select string that performs a select based on a unique key determined by the given property name.default StringgetSelectByUniqueKeyString(String[] propertyNames)Get a SQL select string that performs a select based on a unique key determined by the given property names.StringgetSelectByUniqueKeyString(String[] propertyNames, String[] columnNames)default StringgetSqlAliasStem()Get the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedSqmMultiTableInsertStrategygetSqmMultiTableInsertStrategy()SqmMultiTableMutationStrategygetSqmMultiTableMutationStrategy()The strategy to use for SQM mutation statements where the target entity has multiple tables.EntityPersistergetSubclassEntityPersister(Object instance, SessionFactoryImplementor factory)Obtain theEntityPersisterfor the concrete class of the given entity instance which participates in a mapped inheritance hierarchy with this persister.default String[]getSynchronizationSpaces()The table names this entity needs to be synchronized against.default String[]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.UpdateCoordinatorgetUpdateCoordinator()Get the update coordinator instance.default List<? extends ModelPart>getUpdateGeneratedProperties()default ObjectgetValue(Object object, int i)Extract a specific attribute value from the entity instance, by positiondefault Object[]getValues(Object object)Extract the individual attribute values from the entity instanceObjectgetVersion(Object object)Get the version number (or timestamp) from the object's version property.default BeforeExecutionGeneratorgetVersionGenerator()default VersionJavaType<Object>getVersionJavaType()intgetVersionProperty()IfisVersioned(), then what is the index of the property holding the locking value.BasicType<?>getVersionType()IfisVersioned(), then what is the type of the property holding the locking value.booleanhasCache()Deprecated.UsecanReadFromCache()and/orcanWriteToCache()depending on needdefault booleanhasCascadeDelete()Determine whether this entity has any delete cascading.booleanhasCascades()Determine whether this entity has any (non-none) cascading.booleanhasCollectionNotReferencingPK()Determine whether this entity contains references to persistent collections not referencing the primary key.booleanhasCollections()Determine whether this entity contains references to persistent collections.booleanhasFilterForLoadByKey()booleanhasIdentifierProperty()Determine whether the entity has a particular property holding the identifier value.booleanhasInsertGeneratedProperties()Does this entity define any properties as being database generated on insert?booleanhasLazyProperties()Determine whether this entity defines any lazy properties (when bytecode instrumentation is enabled).booleanhasMutableProperties()Determine whether any properties of this entity are considered mutable.booleanhasNaturalIdCache()Does this class have a natural id cachebooleanhasNaturalIdentifier()Determine whether this entity defines a natural identifier.default booleanhasOwnedCollections()Determine whether this entity has any owned collections.booleanhasProxy()Determine whether this entity supports dynamic proxies.booleanhasSubselectLoadableCollections()Determine whether this entity contains references to persistent collections which are fetchable by subselect?booleanhasUninitializedLazyProperties(Object object)Does the given instance have any uninitialized lazy properties?booleanhasUpdateGeneratedProperties()Does this entity define any properties as being database generated on update?booleanimplementsLifecycle()Does the class implement theLifecycleinterface?default ObjectinitializeEnhancedEntityUsedAsProxy(Object entity, String nameOfAttributeBeingAccessed, SharedSessionContractImplementor session)Called fromEnhancementAsProxyLazinessInterceptorto 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 Objectinsert(Object[] fields, Object object, SharedSessionContractImplementor session)Deprecated, for removal: This API element is subject to removal in a future version.default voidinsert(Object id, Object[] fields, Object object, SharedSessionContractImplementor session)Deprecated, for removal: This API element is subject to removal in a future version.Objectinstantiate(Object id, SharedSessionContractImplementor session)Create a class instance initialized with the given identifierdefault booleanisBatchLoadable()Is batch loading enabled?booleanisCacheInvalidationRequired()Should we always invalidate the cache instead of recaching updated statebooleanisIdentifierAssignedByInsert()Are identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.booleanisInherited()Determine whether the entity is inherited one or more other entities.booleanisInstance(Object object)Is the given object an instance of this entity?booleanisInstrumented()Has the class actually been bytecode instrumented?booleanisLazyPropertiesCacheable()Should lazy properties of this entity be cached?booleanisMutable()Determine whether instances of this entity are considered mutable.default booleanisPropertySelectable(int propertyNumber)booleanisSelectBeforeUpdateRequired()Is select snapshot before update enabled?booleanisSubclassEntityName(String entityName)Determine whether the given name represents a subclass entity (or this entity itself) of the entity mapped by this persister.BooleanisTransient(Object object, SharedSessionContractImplementor session)Is this a new transient instance?booleanisVersioned()Determine whether optimistic locking by column is enabled for this entity.booleanisVersionPropertyGenerated()Does this entity contain a version property that is defined to be database generated?Objectload(Object id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session)Load an instance of the persistent class.default Objectload(Object id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session, Boolean readOnly)Deprecated.Objectload(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session)Load an instance of the persistent class.default Objectload(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session, Boolean readOnly)default ObjectloadByUniqueKey(String propertyName, Object uniqueKey, SharedSessionContractImplementor session)Load an instance of the persistent class, by a unique key other than the primary key.ObjectloadEntityIdByNaturalId(Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session)Load the id for the entity based on the natural id.voidlock(Object id, Object version, Object object, LockMode lockMode, EventSource session)Do a version check (optional operation)voidlock(Object id, Object version, Object object, LockOptions lockOptions, EventSource session)Do a version check (optional operation)default voidmerge(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.voidpostInstantiate()Finish the initialization of this object.default voidprepareLoaders()Prepare loaders associated with the persister.default voidprocessInsertGeneratedProperties(Object id, Object entity, Object[] state, SharedSessionContractImplementor session)Deprecated, for removal: This API element is subject to removal in a future version.default voidprocessInsertGeneratedProperties(Object id, Object entity, Object[] state, GeneratedValues generatedValues, SharedSessionContractImplementor session)Retrieve the values of any insert generated properties through the providedGeneratedValuesor, 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 voidprocessUpdateGeneratedProperties(Object id, Object entity, Object[] state, SharedSessionContractImplementor session)Deprecated, for removal: This API element is subject to removal in a future version.voidprocessUpdateGeneratedProperties(Object id, Object entity, Object[] state, GeneratedValues generatedValues, SharedSessionContractImplementor session)Retrieve the values of any update generated properties through the providedGeneratedValuesor, 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.voidresetIdentifier(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 attributesvoidsetIdentifier(Object entity, Object id, SharedSessionContractImplementor session)Inject the identifier value into the given entity.voidsetPropertyValue(Object object, int i, Object value)Deprecated.voidsetPropertyValues(Object object, Object[] values)Deprecated.UsesetValues(java.lang.Object, java.lang.Object[])insteaddefault voidsetValue(Object object, int i, Object value)Inject a specific attribute value into the entity instance, by positiondefault voidsetValues(Object object, Object[] values)Inject the attribute values into the entity instancebooleanstoreDiscriminatorInShallowQueryCacheLayout()Iterable<UniqueKeyEntry>uniqueKeyEntries()default voidupdate(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.booleanuseShallowQueryCacheLayout()default voidvisitQuerySpaces(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, pruneForSubclasses, resolveConcreteProxyTypeForId, visitAttributeMappings, visitConstraintOrderedTables, visitDeclaredAttributeMappings, visitSubTypeAttributeMappings, visitSuperTypeAttributeMappings
-
Methods inherited from interface org.hibernate.persister.entity.mutation.EntityMutationTarget
getIdentifierDescriptor, getIdentifierTableMapping, getIdentityInsertDelegate, getInsertDelegate, getMutationDelegate, getTargetPart, getUpdateDelegate, hasSkippableTables
-
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 Detail
-
ENTITY_ID
@Deprecated(since="6.2") static final String ENTITY_ID
Deprecated.this feature of HQL is now deprecatedThe property name of the "special" identifier property in HQL- See Also:
- Constant Field Values
-
-
Method Detail
-
postInstantiate
void postInstantiate() throws MappingExceptionFinish 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
SessionFactorylifecycle, 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 theSessionFactoryto which this persister belongs.- Returns:
- The owning
SessionFactory.
-
getSqlAliasStem
default String getSqlAliasStem()
Description copied from interface:TableGroupProducerGet 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:
getSqlAliasStemin interfaceEntityMappingType- Specified by:
getSqlAliasStemin interfaceTableGroupProducer- See Also:
SqlAliasBaseManager.createSqlAliasBase(java.lang.String)
-
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:
getEntityNamein interfaceEntityMappingType- Returns:
- The name of the entity which this persister maps.
-
getSqmMultiTableMutationStrategy
SqmMultiTableMutationStrategy getSqmMultiTableMutationStrategy()
The strategy to use for SQM mutation statements where the target entity has multiple tables. Returnsnullto indicate that the entity does not have multiple tables.- Specified by:
getSqmMultiTableMutationStrategyin interfaceEntityMappingType
-
getSqmMultiTableInsertStrategy
SqmMultiTableInsertStrategy getSqmMultiTableInsertStrategy()
- Specified by:
getSqmMultiTableInsertStrategyin interfaceEntityMappingType
-
getEntityMetamodel
EntityMetamodel getEntityMetamodel()
Retrieve the underlying entity metamodel instance.- Returns:
- The metamodel
-
initializeEnhancedEntityUsedAsProxy
default Object initializeEnhancedEntityUsedAsProxy(Object entity, String nameOfAttributeBeingAccessed, SharedSessionContractImplementor session)
Called fromEnhancementAsProxyLazinessInterceptorto 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.
-
isSubclassEntityName
boolean isSubclassEntityName(String entityName)
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
default String[] getSynchronizationSpaces()
The 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
default String[] 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
default void visitQuerySpaces(Consumer<String> querySpaceConsumer)
Description copied from interface:EntityMappingTypeVisit each "query space" for the mapped entity.- Specified by:
visitQuerySpacesin 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.
-
findDirty
int[] findDirty(Object[] currentState, Object[] previousState, Object owner, SharedSessionContractImplementor session)
Compare the two snapshots to determine if they represent dirty state.- Parameters:
currentState- The current snapshotpreviousState- The baseline snapshotowner- The entity containing the statesession- The originating session- Returns:
- The indices of all dirty properties, or null if no properties were dirty.
-
findModified
int[] findModified(Object[] old, Object[] current, Object object, SharedSessionContractImplementor session)
Compare the two snapshots to determine if they represent modified state.- Parameters:
old- The baseline snapshotcurrent- The current snapshotobject- The entity containing the statesession- The originating session- Returns:
- The indices of all modified properties, or null if no properties were modified.
-
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(since="6") default boolean 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
default VersionJavaType<Object> 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.
-
getNaturalIdentifierSnapshot
Object getNaturalIdentifierSnapshot(Object id, SharedSessionContractImplementor session)
Retrieve the current state of the natural-id properties from the database.- Parameters:
id- The identifier of the entity for which to retrieve the natural-id values.session- The session from which the request originated.- Returns:
- The natural-id snapshot.
-
getIdentifierGenerator
@Deprecated IdentifierGenerator getIdentifierGenerator()
Deprecated.usegetGenerator()Determine which identifier generation strategy is used for this entity.- Returns:
- The identifier generation strategy.
-
getGenerator
default Generator getGenerator()
-
getVersionGenerator
default BeforeExecutionGenerator getVersionGenerator()
-
getAttributeMapping
default AttributeMapping getAttributeMapping(int position)
Description copied from interface:EntityMappingTypeRetrieve an attribute mapping by position, relative to all attributes- Specified by:
getAttributeMappingin interfaceEntityMappingType- Specified by:
getAttributeMappingin interfaceManagedMappingType
-
breakDownJdbcValues
default <X,Y> int breakDownJdbcValues(Object domainValue, int offset, X x, Y y, ModelPart.JdbcValueBiConsumer<X,Y> valueConsumer, SharedSessionContractImplementor session)
Description copied from interface:ModelPartBreaks down the domain value to its constituent JDBC values. Think of it as breaking the multi-dimensional array into a visitable flat array. Additionally, it passes through the valuesXandYto the consumer. Returns the amount of jdbc types that have been visited.- Specified by:
breakDownJdbcValuesin interfaceModelPart
-
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
default NaturalIdLoader<?> getNaturalIdLoader()
Description copied from interface:EntityMappingTypeAccess to performing natural-id database selection. This is per-entity in the hierarchy- Specified by:
getNaturalIdLoaderin interfaceEntityMappingType
-
getMultiNaturalIdLoader
default MultiNaturalIdLoader<?> getMultiNaturalIdLoader()
Description copied from interface:EntityMappingTypeAccess to performing multi-value natural-id database selection. This is per-entity in the hierarchy- Specified by:
getMultiNaturalIdLoaderin interfaceEntityMappingType
-
loadEntityIdByNaturalId
Object loadEntityIdByNaturalId(Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session)
Load the id for the entity based on the natural id.
-
load
Object load(Object id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session)
Load an instance of the persistent class.
-
load
@Deprecated(since="6.0") default Object load(Object id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session, Boolean readOnly) throws HibernateException
Deprecated.- Throws:
HibernateException
-
load
Object load(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session)
Load an instance of the persistent class.
-
load
default Object load(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session, Boolean readOnly) throws HibernateException
- Throws:
HibernateException
-
multiLoad
List<?> multiLoad(Object[] ids, EventSource session, MultiIdLoadOptions loadOptions)
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
-
loadByUniqueKey
default Object loadByUniqueKey(String propertyName, Object uniqueKey, SharedSessionContractImplementor session)
Description copied from interface:EntityMappingTypeLoad an instance of the persistent class, by a unique key other than the primary key.- Specified by:
loadByUniqueKeyin interfaceEntityMappingType
-
lock
void lock(Object id, Object version, Object object, LockMode lockMode, EventSource session)
Do a version check (optional operation)
-
lock
void lock(Object id, Object version, Object object, LockOptions lockOptions, EventSource session)
Do a version check (optional operation)
-
insert
@Deprecated(forRemoval=true, since="6.5") 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.Persist an instance- See Also:
getInsertCoordinator()
-
insert
@Deprecated(forRemoval=true, since="6.5") default Object insert(Object[] fields, Object object, SharedSessionContractImplementor session)
Deprecated, for removal: This API element is subject to removal in a future version.Persist an instance- See Also:
getInsertCoordinator()
-
delete
@Deprecated(forRemoval=true, since="6.5") default void delete(Object id, Object version, Object object, SharedSessionContractImplementor session)
Deprecated, for removal: This API element is subject to removal in a future version.Delete a persistent instance- See Also:
getDeleteCoordinator()
-
update
@Deprecated(forRemoval=true, since="6.5") default 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.Update a persistent instance- See Also:
getUpdateCoordinator()
-
merge
@Deprecated(forRemoval=true, since="6.5") 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.Merge a persistent instance- See Also:
getMergeCoordinator()
-
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
default UpdateCoordinator 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()
-
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 boolean 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
-
buildCacheEntry
CacheEntry buildCacheEntry(Object entity, Object[] state, Object version, SharedSessionContractImplementor session)
-
hasNaturalIdCache
boolean hasNaturalIdCache()
Does this class have a natural id cache
-
getNaturalIdCacheAccessStrategy
NaturalIdDataAccess getNaturalIdCacheAccessStrategy()
Get the NaturalId cache (optional operation)
-
getClassMetadata
@Deprecated(since="6.0") ClassMetadata getClassMetadata()
Deprecated.This operation is no longer called by Hibernate.Get the user-visible metadata for the class (optional operation)
-
getBatchSize
default int getBatchSize()
The batch size for batch loading.- Specified by:
getBatchSizein interfaceLoadable- See Also:
LoadQueryInfluencers.effectiveBatchSize(EntityPersister)
-
isBatchLoadable
default boolean isBatchLoadable()
Is batch loading enabled?
-
isSelectBeforeUpdateRequired
boolean isSelectBeforeUpdateRequired()
Is select snapshot before update enabled?
-
getDatabaseSnapshot
Object[] getDatabaseSnapshot(Object id, SharedSessionContractImplementor session) throws HibernateException
Get the current database state of the object, in a "hydrated" form, without resolving identifiers.- Returns:
- null if there is no row in the database
- Throws:
HibernateException
-
getIdByUniqueKey
Object getIdByUniqueKey(Object key, String uniquePropertyName, SharedSessionContractImplementor session)
-
getCurrentVersion
Object getCurrentVersion(Object id, SharedSessionContractImplementor session) throws HibernateException
Get the current version of the object, or return null if there is no row for the given identifier. In the case of unversioned data, return any object if the row exists.- Throws:
HibernateException
-
forceVersionIncrement
Object forceVersionIncrement(Object id, Object currentVersion, SharedSessionContractImplementor session) throws HibernateException
- Throws:
HibernateException
-
forceVersionIncrement
default Object forceVersionIncrement(Object id, Object currentVersion, boolean batching, SharedSessionContractImplementor session) throws HibernateException
- Throws:
HibernateException
-
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.
-
afterInitialize
void afterInitialize(Object entity, SharedSessionContractImplementor session)
Called just after the entities properties have been initialized
-
afterReassociate
void afterReassociate(Object entity, SharedSessionContractImplementor session)
Called just after the entity has been reassociated with the session
-
createProxy
Object createProxy(Object id, SharedSessionContractImplementor session)
Create a new proxy instance
-
isTransient
Boolean isTransient(Object object, SharedSessionContractImplementor session)
Is this a new transient instance?
-
getPropertyValuesToInsert
Object[] getPropertyValuesToInsert(Object object, Map<Object,Object> mergeMap, SharedSessionContractImplementor session)
Return the values of the insertable properties of the object (including backrefs)
-
processInsertGeneratedProperties
@Deprecated(forRemoval=true, since="6.5") 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.Perform a select to retrieve the values of any generated properties back from the database, injecting these generated values into the given entity as well as writing this state to thePersistenceContext.Note, that because we update the PersistenceContext here, callers need to take care that they have already written the initial snapshot to the PersistenceContext before calling this method.
-
processInsertGeneratedProperties
default void processInsertGeneratedProperties(Object id, Object entity, Object[] state, GeneratedValues generatedValues, SharedSessionContractImplementor session)
Retrieve the values of any insert generated properties through the providedGeneratedValuesor, 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.Note, that because we update the PersistenceContext here, callers need to take care that they have already written the initial snapshot to the PersistenceContext before calling this method.
-
processUpdateGeneratedProperties
@Deprecated(forRemoval=true, since="6.5") 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.Perform a select to retrieve the values of any generated properties back from the database, injecting these generated values into the given entity as well as writing this state to thePersistenceContext.Note, that because we update the PersistenceContext here, callers need to take care that they have already written the initial snapshot to the PersistenceContext before calling this method.
-
processUpdateGeneratedProperties
void processUpdateGeneratedProperties(Object id, Object entity, Object[] state, GeneratedValues generatedValues, SharedSessionContractImplementor session)
Retrieve the values of any update generated properties through the providedGeneratedValuesor, 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.Note, that because we update the PersistenceContext here, callers need to take care that they have already written the initial snapshot to the PersistenceContext before calling this method.
-
getMappedClass
Class<?> getMappedClass()
The persistent class, or null
-
implementsLifecycle
boolean implementsLifecycle()
Does the class implement theLifecycleinterface?
-
getConcreteProxyClass
Class<?> getConcreteProxyClass()
Get the proxy interface that instances of this concrete class will be cast to (optional operation).
-
setValues
default void setValues(Object object, Object[] values)
Description copied from interface:ManagedMappingTypeInject the attribute values into the entity instance- Specified by:
setValuesin interfaceManagedMappingType
-
setPropertyValues
@Deprecated(since="6.0") void setPropertyValues(Object object, Object[] values)
Deprecated.UsesetValues(java.lang.Object, java.lang.Object[])insteadSet the given values to the mapped properties of the given object.
-
setValue
default void setValue(Object object, int i, Object value)
Description copied from interface:ManagedMappingTypeInject a specific attribute value into the entity instance, by position- Specified by:
setValuein interfaceManagedMappingType
-
setPropertyValue
@Deprecated(since="6.0") void setPropertyValue(Object object, int i, Object value)
Deprecated.Set the value of a particular property of the given instance.
-
getValues
default Object[] getValues(Object object)
Description copied from interface:ManagedMappingTypeExtract the individual attribute values from the entity instance- Specified by:
getValuesin interfaceManagedMappingType
-
getPropertyValues
@Deprecated(since="6.0") Object[] getPropertyValues(Object object)
Deprecated.UsegetValues(java.lang.Object)instead
-
getValue
default Object getValue(Object object, int i)
Description copied from interface:ManagedMappingTypeExtract a specific attribute value from the entity instance, by position- Specified by:
getValuein interfaceManagedMappingType
-
getPropertyValue
@Deprecated(since="6.0") Object getPropertyValue(Object object, int i) throws HibernateException
Deprecated.UsegetValue(java.lang.Object, int)instead- Throws:
HibernateException
-
getPropertyValue
Object getPropertyValue(Object object, String propertyName)
Get the value of a particular property
-
getIdentifier
Object getIdentifier(Object entity, SharedSessionContractImplementor session)
Get the identifier of an instance from the object's identifier property. Throw an exception if it has no identifier property.
-
getIdentifier
default Object getIdentifier(Object entity, MergeContext mergeContext)
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
-
setIdentifier
void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session)
Inject the identifier value into the given entity.
-
getVersion
Object getVersion(Object object) throws HibernateException
Get the version number (or timestamp) from the object's version property. Returnnullif it is not versioned.- Throws:
HibernateException
-
instantiate
Object instantiate(Object id, SharedSessionContractImplementor session)
Create a class instance initialized with the given identifier- Parameters:
id- The identifier value to use (may be null to represent no value)session- The session from which the request originated.- Returns:
- The instantiated entity.
-
isInstance
boolean isInstance(Object object)
Is the given object an instance of this entity?
-
hasUninitializedLazyProperties
boolean hasUninitializedLazyProperties(Object object)
Does the given instance have any uninitialized lazy properties?
-
resetIdentifier
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.
-
getSubclassEntityPersister
EntityPersister getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory)
Obtain theEntityPersisterfor 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
Animalas the entity name which gets resolved to this persister. But the actual instance is really an instance ofCatwhich is a subclass ofAnimal. So, here theAnimalpersister is being asked to return the persister specific toCat.It's also possible that the instance is actually an
Animalinstance in the above example in which case we would returnthisfrom 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:EntityMappingTypeDescribes how the entity is represented in the application's domain model.- Specified by:
getRepresentationStrategyin interfaceEntityMappingType
-
getEntityMappingType
default EntityMappingType getEntityMappingType()
Description copied from interface:EntityValuedModelPartThe descriptor of the entity that is the type for this part- Specified by:
getEntityMappingTypein interfaceEntityValuedModelPart
-
addToCacheKey
default void addToCacheKey(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session)
Description copied from interface:BindableAdd to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.- Specified by:
addToCacheKeyin interfaceBindable- Specified by:
addToCacheKeyin interfaceEntityValuedModelPart- Parameters:
cacheKey- the MutableCacheKey used to add the disassembled value and the hashCodevalue- the value to disassemblesession- the SharedSessionContractImplementor
-
getInstrumentationMetadata
BytecodeEnhancementMetadata getInstrumentationMetadata()
-
getBytecodeEnhancementMetadata
default BytecodeEnhancementMetadata getBytecodeEnhancementMetadata()
-
getFilterAliasGenerator
org.hibernate.internal.FilterAliasGenerator getFilterAliasGenerator(String rootAlias)
-
getFilterAliasGenerator
default org.hibernate.internal.FilterAliasGenerator getFilterAliasGenerator(TableGroup rootTableGroup)
-
resolveAttributeIndexes
int[] resolveAttributeIndexes(String[] attributeNames)
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
@Incubating boolean useShallowQueryCacheLayout()
-
storeDiscriminatorInShallowQueryCacheLayout
@Incubating boolean storeDiscriminatorInShallowQueryCacheLayout()
-
hasFilterForLoadByKey
boolean hasFilterForLoadByKey()
-
uniqueKeyEntries
@Incubating Iterable<UniqueKeyEntry> uniqueKeyEntries()
- Returns:
- Metadata for each unique key defined
-
getSelectByUniqueKeyString
String getSelectByUniqueKeyString(String propertyName)
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
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.- 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
String getSelectByUniqueKeyString(String[] propertyNames, String[] columnNames)
-
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()
-
-