Class AbstractEntityPersister
- All Implemented Interfaces:
LazyPropertyInitializer
,FetchProfileAffectee
,Loadable
,Bindable
,Discriminable
,EntityMappingType
,EntityValuedModelPart
,FilterRestrictable
,InFlightEntityMappingType
,JdbcMappingContainer
,ManagedMappingType
,MappingModelExpressible
,MappingType
,ModelPart
,ModelPartContainer
,Restrictable
,SoftDeletableModelPart
,WhereRestrictable
,EntityPersister
,Joinable
,EntityMutationTarget
,AttributeSource
,RootTableGroupProducer
,TableGroupProducer
,MutationTarget<EntityTableMapping>
,FetchableContainer
- Direct Known Subclasses:
JoinedSubclassEntityPersister
,SingleTableEntityPersister
,UnionSubclassEntityPersister
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Consolidated these onto a single helper because the 2 pieces work in tandem.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.bytecode.enhance.spi.LazyPropertyInitializer
LazyPropertyInitializer.InterceptorImplementor
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.ModelPart
ModelPart.JdbcValueBiConsumer<X,
Y>, ModelPart.JdbcValueConsumer -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ReflectionOptimizer.AccessOptimizer
protected final int
protected String[]
Deprecated.protected String[]
Deprecated.protected String[]
Deprecated.protected AttributeMappingsMap
protected boolean[]
Deprecated.protected Expectation[]
Deprecated.static final String
protected final String[]
protected boolean[]
Deprecated.protected Expectation[]
Deprecated.static final String
protected final String
protected AttributeMappingsList
protected boolean[]
Deprecated.protected Expectation[]
Deprecated.static final String
Fields inherited from interface org.hibernate.persister.entity.EntityPersister
ENTITY_ID
Fields inherited from interface org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer
UNFETCHED_PROPERTY
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractEntityPersister
(PersistentClass persistentClass, EntityDataAccess cacheAccessStrategy, NaturalIdDataAccess naturalIdRegionAccessStrategy, RuntimeModelCreationContext creationContext) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDiscriminatorToInsertGroup
(MutationGroupBuilder insertGroupBuilder) void
addSoftDeleteToInsertGroup
(MutationGroupBuilder insertGroupBuilder) 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 sessionvoid
applyBaseRestrictions
(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String, Filter> enabledFilters, boolean onlyApplyLoadByKeyFilters, Set<String> treatAsDeclarations, SqlAstCreationState creationState) Applies the base set of restrictions.void
applyDiscriminator
(Consumer<Predicate> predicateConsumer, String alias, TableGroup tableGroup, SqlAstCreationState creationState) Apply the discriminator as a predicate via thepredicateConsumer
void
applyFilterRestrictions
(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String, Filter> enabledFilters, boolean onlyApplyLoadByKeyFilters, SqlAstCreationState creationState) Applies just theFilter
values enabled for the associated entityvoid
applySqlSelections
(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState) Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.void
applySqlSelections
(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState, BiConsumer<SqlSelection, JdbcMapping> selectionConsumer) Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.void
applyWhereRestrictions
(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, SqlAstCreationState creationState) Apply theSQLRestriction
restrictionsbuildCacheEntry
(Object entity, Object[] state, Object version, SharedSessionContractImplementor session) protected AbstractEntityPersister.CacheEntryHelper
protected DeleteCoordinator
protected EmbeddedAttributeMapping
buildEmbeddedAttributeMapping
(String attrName, int stateArrayPosition, int fetchableIndex, Property bootProperty, DependantValue dependantValue, int dependantColumnIndex, ManagedMappingType declaringType, CompositeType attrType, String tableExpression, String[] rootTableKeyColumnNames, PropertyAccess propertyAccess, CascadeStyle cascadeStyle, MappingModelCreationProcess creationProcess) For Hibernate Reactiveprotected InsertCoordinator
protected UpdateCoordinator
protected MultiIdEntityLoader<Object>
protected AttributeMapping
buildPluralAttributeMapping
(String attrName, int stateArrayPosition, int fetchableIndex, Property bootProperty, ManagedMappingType declaringType, PropertyAccess propertyAccess, CascadeStyle cascadeStyle, FetchMode fetchMode, MappingModelCreationProcess creationProcess) For Hibernate Reactiveprotected SingleIdEntityLoader<?>
For Hibernate Reactiveprotected AttributeMapping
buildSingularAssociationAttributeMapping
(String attrName, NavigableRole navigableRole, int stateArrayPosition, int fetchableIndex, Property bootProperty, ManagedMappingType declaringType, EntityPersister declaringEntityPersister, EntityType attrType, PropertyAccess propertyAccess, CascadeStyle cascadeStyle, MappingModelCreationProcess creationProcess) For Hibernate Reactiveprotected EntityTableMapping[]
Builds the EntityTableMapping descriptors for the tables mapped by this entity.protected UpdateCoordinator
boolean
boolean
boolean
boolean
containsTableReference
(String tableExpression) int
<T> DomainResult<T>
createDomainResult
(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState) Create a DomainResult for a specific reference to this ModelPart.protected GeneratedValuesProcessor
createGeneratedValuesProcessor
(EventType timing, List<AttributeMapping> generatedAttributes) protected GeneratedValuesMutationDelegate
createPrimaryTableReference
(SqlAliasBase sqlAliasBase, SqlAstCreationState sqlAstCreationState) createProxy
(Object id, SharedSessionContractImplementor session) Create a new proxy instancecreateRootTableGroup
(boolean canUseInnerJoins, NavigablePath navigablePath, String explicitSourceAlias, SqlAliasBase explicitSqlAliasBase, Supplier<Consumer<Predicate>> additionalPredicateCollectorAccess, SqlAstCreationState creationState) Create a root TableGroup as defined by this producercreateTableReferenceJoin
(String joinTableExpression, SqlAliasBase sqlAliasBase, TableReference lhs, SqlAstCreationState creationState) protected GeneratedValuesMutationDelegate
protected SingleIdEntityLoader<?>
protected String
determineTableName
(Table table) protected int
determineTableNumberForColumn
(String columnName) disassemble
(Object value, SharedSessionContractImplementor session) Breaks down a value ofJ
into its simple pieces.findAttributeMapping
(String name) Find an attribute by name.Find an attribute-mapping, declared on this entity mapping (not super or subs), by nameint[]
findDirty
(Object[] currentState, Object[] previousState, Object entity, SharedSessionContractImplementor session) Locate the property-indices of all properties considered to be dirty.int[]
findModified
(Object[] old, Object[] current, Object entity, SharedSessionContractImplementor session) Locate the property-indices of all properties considered to be dirty.findSubPart
(String name, EntityMappingType treatTargetType) findSubTypesSubPart
(String name, EntityMappingType treatTargetType) forceVersionIncrement
(Object id, Object currentVersion, boolean batching, SharedSessionContractImplementor session) forceVersionIncrement
(Object id, Object currentVersion, SharedSessionContractImplementor session) void
forEachAttributeMapping
(Consumer<? super AttributeMapping> action) Visit each attribute mappingvoid
forEachAttributeMapping
(IndexedConsumer<? super AttributeMapping> consumer) Visit attributes defined on this class and any supers<X,
Y> int forEachDisassembledJdbcValue
(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X, Y> valuesConsumer, SharedSessionContractImplementor session) LikeBindable.forEachDisassembledJdbcValue(Object, Object, Object, JdbcValuesBiConsumer, SharedSessionContractImplementor)
, but additionally receives an offset by which the selectionIndex is incremented when callingBindable.JdbcValuesBiConsumer.consume(int, Object, Object, Object, JdbcMapping)
.int
forEachJdbcType
(int offset, IndexedConsumer<JdbcMapping> action) Visit each JdbcMapping starting from the given offset<X,
Y> int forEachJdbcValue
(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X, Y> consumer, SharedSessionContractImplementor session) Visit each constituent JDBC value extracted from the entity instance itself.void
forEachMutableTable
(Consumer<EntityTableMapping> consumer) Visit each table.void
forEachMutableTableReverse
(Consumer<EntityTableMapping> consumer) Same asMutationTarget.forEachMutableTable(java.util.function.Consumer<T>)
except that here the tables are visited in reverse orderint
forEachSelectable
(int offset, SelectableConsumer selectableConsumer) Visits each selectable mapping with the selectable index offset by the given value.protected EntityDiscriminatorMapping
generateDiscriminatorMapping
(PersistentClass bootEntityDescriptor) protected EntityIdentifierMapping
generateIdentifierMapping
(Supplier<?> templateInstanceCreator, PersistentClass bootEntityDescriptor, MappingModelCreationProcess creationProcess) protected Predicate
generateJoinPredicate
(TableReference rootTableReference, TableReference joinedTableReference, String[] pkColumnNames, String[] fkColumnNames, SqlAstCreationState creationState) protected LockingStrategy
generateLocker
(LockMode lockMode) protected NaturalIdMapping
generateNaturalIdMapping
(MappingModelCreationProcess creationProcess, PersistentClass bootEntityDescriptor) protected EntityIdentifierMapping
generateNonEncapsulatedCompositeIdentifierMapping
(MappingModelCreationProcess creationProcess, PersistentClass bootEntityDescriptor) protected AttributeMapping
generateNonIdAttributeMapping
(NonIdentifierAttribute tupleAttrDefinition, Property bootProperty, int stateArrayPosition, int fetchableIndex, MappingModelCreationProcess creationProcess) Generate the SQL that selects the version number by idstatic String
generateTableAlias
(String rootAlias, int tableNumber) protected TableReferenceJoin
generateTableReferenceJoin
(TableReference lhs, String joinTableExpression, SqlAliasBase sqlAliasBase, boolean innerJoin, String[] targetColumns, SqlAstCreationState creationState) protected EntityVersionMapping
generateVersionMapping
(Supplier<?> templateInstanceCreator, PersistentClass bootEntityDescriptor, MappingModelCreationProcess creationProcess) protected static EntityVersionMapping
generateVersionMapping
(AbstractEntityPersister entityPersister, Supplier<?> templateInstanceCreator, PersistentClass bootModelRootEntityDescriptor, MappingModelCreationProcess creationProcess) getAttributeMapping
(int position) Retrieve an attribute mapping by position, relative to all attributesThe attributes mapping for this entity, including those declared on supertype mappingsint
The batch size for batch loading.Get the cache (optional operation)Get the cache structurestatic @Nullable Object
getCollectionKey
(CollectionPersister persister, Object owner, EntityEntry ownerEntry, SharedSessionContractImplementor session) Class<?>
Get the proxy interface that instances of this concrete class will be cast to (optional operation).abstract String[]
getCurrentVersion
(Object id, SharedSessionContractImplementor session) Retrieve the version numberObject[]
getDatabaseSnapshot
(Object id, SharedSessionContractImplementor session) Get the current database state of the object, in a "hydrated" form, without resolving identifiers.Get access to the attributes defined on this class - do not access attributes defined on the superGet the delete coordinator instance.getDiscriminatorAlias
(String suffix) Get the result set aliases used for the identifier columns, given a suffixMapping details for the entity's discriminator.abstract BasicType<?>
Get the discriminator typeGet the EntityEntryFactory indicated for the entity mapped by this persister.Retrieve the underlying entity metamodel instance.final String
The entity name which this persister maps.getEntityNameByTableNameMap
(PersistentClass persistentClass, SqlStringGenerationContext stringGenerationContext) Safety-net.Return theSessionFactory
to which this persister belongs.getFetchable
(int position) getFetchMode
(int i) getIdByUniqueKey
(Object key, String uniquePropertyName, SharedSessionContractImplementor session) getIdentifier
(Object entity, SharedSessionContractImplementor session) Get the identifier of an instance from the object's identifier property.getIdentifier
(Object entity, MergeContext mergeContext) Get the identifier of an instance from the object's identifier property.String[]
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 identifierString[]
String[]
int
The ModelPart describing the identifier/key for this targetDeprecated.Mapping details for the entity's identifier.Get the name of the identifier property (or return null) - need not return the name of an actual Java propertyThe descriptor for the table containing the identifier for the targetThe name of the table defining the identifier for this targetGet the identifier typeGet the database-specific SQL command to retrieve the last generated IDENTITY value.Get the insert coordinator instance.getJdbcMapping
(int index) int
The number of JDBC mappings@Nullable String
The JPA entity name, if one, associated with the entity.getKeyFetchable
(int position) protected Map<String,
SingleIdArrayLoadPlan> final Class<?>
The persistent class, or nullJavaType<?>
The descriptor descriptor for the mapped Java typeGet the name of the entity that is the "super class" for this entityGet the merge coordinator instance.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, ifEntityPersister.hasNaturalIdentifier()
returnstrue
, the indices of the properties which make up the natural id.Retrieve the current state of the natural-id properties from the database.Access to performing natural-id database selection.The mapping for the natural-id of the entity, if one is definedThe model role of this targetboolean[]
int
The total number of attributes for this entity, including those declared on supertype mappingsint
Get the number of attributes defined on this entity mapping - do not access attributes defined on the superint
The number of fetchables in the containerint
The number of fetchables in the containerThe local part name, which is generally the unqualified role nameString[]
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
(int i) String[]
getPropertyColumnNames
(String propertyName) Get the column names for the given property pathint
getPropertyIndex
(String propertyName) boolean[]
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 classint
protected abstract int[]
getPropertyType
(String propertyName) Deprecated.by the supertypesType[]
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)boolean[]
getPropertyUpdateability
(Object entity) Which properties appear in the SQL update? (Initialized, updateable ones!)getPropertyValue
(Object object, int i) getPropertyValue
(Object object, String propertyName) Get the value of a particular propertyObject[]
getPropertyValues
(Object object) Object[]
getPropertyValuesToInsert
(Object entity, 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)protected String
getPrunedDiscriminatorPredicate
(Map<String, EntityNameUse> entityNameUses, MappingMetamodelImplementor mappingMetamodel, String alias) 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".The mapping for the row-id of the entity, if one is defined.getSelectByUniqueKeyString
(String propertyName) Get a SQL select string that performs a select based on a unique key determined by the given property name.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) Mapping for soft-delete support, ornull
if soft-delete not definedGet the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedprotected String
The strategy to use for SQM mutation statements where the target entity has multiple tables.protected int
getStateArrayInitialPosition
(MappingModelCreationProcess creationProcess) protected AttributeMappingsList
protected String[]
Deprecated.Hibernate no longer uses aliases to read from result setsgetSubclassEntityPersister
(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.protected String[]
Deprecated.Hibernate no longer uses aliases to read from result setsString[]
getSubclassPropertyColumnAliases
(String propertyName, String suffix) Deprecated.Hibernate no longer uses aliases to read from result setsprotected String[][]
String[]
String[][]
String[][]
String[][]
protected String[]
int
getSubclassPropertyTableNumber
(String propertyPath) Warning: When there are duplicated property names in the subclasses of the class, this method may return the wrong table number for the duplicated subclass property.getSubclassPropertyType
(int i) protected Type[]
protected abstract String[]
getSubclassTableKeyColumns
(int j) protected abstract String[]
Retrieve mappings for all subtypesThe mapping for the entity which is the supertype for this entity mapping.static int
getTableId
(String tableName, String[] tables) protected EntityTableMapping
getTableMapping
(int i) getTableNameForColumn
(String columnName) String[]
The ModelPart describing the mutation targetRetrieve the information needed to properly deal with this entity's discriminator in a query.protected SingleUniqueKeyEntityLoader<?>
getUniqueKeyLoader
(String attributeName, SharedSessionContractImplementor session) Get the update coordinator instance.getVersion
(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.Mapping details for the entity's version when using the version strategy.int
IfEntityPersister.isVersioned()
, then what is the index of the property holding the locking value.BasicType<?>
IfEntityPersister.isVersioned()
, then what is the type of the property holding the locking value.boolean
hasCache()
Does this class have a cache.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.boolean
Determine whether this entity has any owned collections.boolean
boolean
hasProxy()
Determine whether this entity supports dynamic proxies.boolean
hasRowId()
Does the result set contain rowids?boolean
Whether this entity mapping has any subtype mappingsboolean
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?boolean
Does this restrictable have a where restriction?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.protected Object
initializeLazyPropertiesFromCache
(String fieldName, Object entity, SharedSessionContractImplementor session, EntityEntry entry, CacheEntry cacheEntry) protected Object
initializeLazyPropertiesFromDatastore
(Object entity, Object id, EntityEntry entry, String fieldName, SharedSessionContractImplementor session) protected boolean
initializeLazyProperty
(String fieldName, Object entity, EntityEntry entry, int index, Object propValue) Called by Hibernate Reactiveprotected boolean
initializeLazyProperty
(String fieldName, Object entity, EntityEntry entry, LazyAttributeDescriptor fetchGroupAttributeDescriptor, Object propValue) initializeLazyProperty
(String fieldName, Object entity, SharedSessionContractImplementor session) Initialize the property, and return its new value.initInsertGeneratedProperties
(List<AttributeMapping> generatedAttributes) protected void
initPropertyPaths
(Metadata mapping) protected void
Deprecated.Hibernate no longer uses aliases to read from result setsinitUpdateGeneratedProperties
(List<AttributeMapping> generatedAttributes) instantiate
(Object id, SharedSessionContractImplementor session) Create a class instance initialized with the given identifierprotected static SqmMultiTableInsertStrategy
interpretSqmMultiTableInsertStrategy
(AbstractEntityPersister entityMappingDescriptor, MappingModelCreationProcess creationProcess) protected static SqmMultiTableMutationStrategy
interpretSqmMultiTableStrategy
(AbstractEntityPersister entityMappingDescriptor, MappingModelCreationProcess creationProcess) boolean
Whether this entity is defined as abstract using the Javaabstract
keywordboolean
isAffectedByEnabledFetchProfiles
(LoadQueryInfluencers loadQueryInfluencers) Whether any of the LoadQueryInfluencers.getEnabledFetchProfileNames() apply to this loadableboolean
isAffectedByEnabledFilters
(LoadQueryInfluencers loadQueryInfluencers, boolean onlyApplyForLoadByKeyFilters) Whether any of the "influencers" affect this loadable.boolean
isAffectedByEntityGraph
(LoadQueryInfluencers loadQueryInfluencers) Whether the effective entity-graph applies to this loadableboolean
We can't immediately add to the cache if we have formulas which must be evaluated, or if we have the possibility of two concurrent updates to the same item being merged on the database.protected boolean
isClassOrSuperclassJoin
(int j) protected abstract boolean
isClassOrSuperclassTable
(int j) boolean
Returnstrue
if this entity type's hierarchy is configured to return concrete-typed proxies.protected boolean
boolean
Is this class explicit polymorphism only?boolean
Are identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.protected abstract boolean
isIdentifierTable
(String tableExpression) 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.protected boolean
isNullableSubclassTable
(int j) boolean
isNullableTable
(int j) protected boolean
abstract boolean
isPropertyOfTable
(int property, int j) 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.protected boolean
isSubclassTableIndicatedByTreatAsDeclarations
(int subclassTableNumber, Set<String> treatAsDeclarations) abstract boolean
isTableCascadeDeleteEnabled
(int j) isTransient
(Object entity, SharedSessionContractImplementor session) Is this a new transient instance?boolean
isTypeOrSuperType
(EntityMappingType targetType) Whether the passed entity mapping is the same as or is a supertype of this entity mappingboolean
Determine whether optimistic locking by column is enabled for this entity.boolean
boolean
boolean
Does this entity contain a version property that is defined to be database generated?protected void
linkToSession
(Object entity, SharedSessionContractImplementor session) void
linkWithSubType
(EntityMappingType sub, MappingModelCreationProcess creationProcess) void
linkWithSuperType
(MappingModelCreationProcess creationProcess) Link an entity type with its super-type, if one.load
(Object id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session) Load an instance using either theforUpdateLoader
or the outer joiningloader
, depending upon the value of thelock
parameterload
(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session) Load an instance using either theforUpdateLoader
or the outer joiningloader
, depending upon the value of thelock
parameterload
(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session, Boolean readOnly) loadByUniqueKey
(String propertyName, Object uniqueKey, Boolean readOnly, SharedSessionContractImplementor session) 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)protected void
boolean
managesColumns
(String[] columnNames) List<?>
multiLoad
(Object[] ids, EventSource session, MultiIdLoadOptions loadOptions) Performs a load of multiple entities (of this type) by identifier simultaneously.abstract boolean
final OptimisticLockStyle
The type of optimistic locking, if any, defined for this entity mappingphysicalTableNameForMutation
(SelectableMapping selectableMapping) Unfortunately we cannot directly use `SelectableMapping#getContainingTableExpression()` as that blows up for attributes declared on super-type for union-subclass mappingsprotected void
postConstruct
(Metadata mapping) Post-construct is a callback for AbstractEntityPersister subclasses to call after they are all done with their constructor processing.final void
Finish the initialization of this object.void
Prepare loaders associated with the persister.void
prepareMappingModel
(MappingModelCreationProcess creationProcess) After all hierarchy types have been linked, this method is called to allow the mapping model to be prepared which generally includes creating attribute mapping descriptors, identifier mapping descriptor, etc.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
.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
registerAffectingFetchProfile
(String fetchProfileName) Register the profile name with the entity/collectionvoid
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 metamodelIf this entity is configured to return concrete-typed proxies, this method queries the entity table(s) do determine the concrete entity type associated with the provided id and returns its persister.int[]
resolveDirtyAttributeIndexes
(Object[] currentState, Object[] previousState, String[] attributeNames, SessionImplementor session) LikeEntityPersister.resolveAttributeIndexes(String[])
but also always returns mutable attributesprotected DiscriminatorType<?>
selectFragment
(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) Set the value of a particular property of the given instance.void
setPropertyValues
(Object object, Object[] values) Set the given values to the mapped properties of the given object.protected boolean
shouldGetAllProperties
(Object entity) protected boolean
shouldInnerJoinSubclassTable
(int subclassTableNumber, Set<String> treatAsDeclarations) protected boolean
boolean
protected String
substituteBrackets
(String sql) String[]
Given a property path, return the corresponding column name(s).toString()
boolean
protected void
void
visitAttributeMappings
(Consumer<? super AttributeMapping> action) Visit the mappings, but limited to just attributes defined in the targetType or its super-type(s) if any.void
visitDeclaredAttributeMappings
(Consumer<? super AttributeMapping> action) Visit attributes defined on this class - do not visit attributes defined on the supervoid
visitFetchables
(Consumer<? super Fetchable> fetchableConsumer, EntityMappingType treatTargetType) void
visitFetchables
(IndexedConsumer<? super Fetchable> fetchableConsumer, EntityMappingType treatTargetType) void
visitKeyFetchables
(Consumer<? super Fetchable> fetchableConsumer, EntityMappingType treatTargetType) void
visitKeyFetchables
(IndexedConsumer<? super Fetchable> fetchableConsumer, EntityMappingType treatTargetType) protected abstract void
visitMutabilityOrderedTables
(org.hibernate.persister.entity.AbstractEntityPersister.MutabilityOrderedTableConsumer consumer) Visit details about each table for this entity, using "mutability ordering".void
visitSubParts
(Consumer<ModelPart> consumer, EntityMappingType treatTargetType) void
visitSubTypeAttributeMappings
(Consumer<? super AttributeMapping> action) Walk this type's attributes as well as its sub-type'svoid
visitSuperTypeAttributeMappings
(Consumer<? super AttributeMapping> action) Walk this type's attributes as well as its super-type'sMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
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
asEntityMappingType, extractConcreteTypeStateValues, findContainingEntityMapping, findSubPart, getContributor, getDiscriminatorSQLValue, getDiscriminatorValue, getIdentifierMappingForJoin, getIdentifierTableDetails, getJavaType, getMappedTableDetails, getPartMappingType, getRootEntityDescriptor, getRootPathName, getSoftDeleteTableDetails, getSubclassEntityNames, getSubclassId, isTypeOrSuperType, pruneForSubclasses, visitConstraintOrderedTables
Methods inherited from interface org.hibernate.persister.entity.mutation.EntityMutationTarget
getAttributeMutationTableName, getIdentityInsertDelegate, getMutationDelegate
Methods inherited from interface org.hibernate.persister.entity.EntityPersister
addToCacheKey, breakDownJdbcValues, canExtractIdOutOfEntity, delete, getConstraintOrderedTableKeyColumnClosure, getEntityMappingType, getFilterAliasGenerator, getFilterAliasGenerator, getGeneratedProperties, getIdentifier, getImportedName, getKeyColumns, getPropertySpaces, getSubclassTableName, getSubclassTableSpan, getSynchronizationSpaces, getSynchronizedQuerySpaces, getTableName, getTableName, getTableSpan, getValue, getValues, getVersionJavaType, hasDuplicateTables, insert, insert, isBatchLoadable, load, merge, processInsertGeneratedProperties, processUpdateGeneratedProperties, setValue, setValues, update, visitQuerySpaces
Methods inherited from interface org.hibernate.metamodel.mapping.EntityValuedModelPart
forEachSubPart
Methods inherited from interface org.hibernate.sql.results.graph.FetchableContainer
getNumberOfKeyFetchables, getSelectableIndex, visitFetchables, visitKeyFetchables
Methods inherited from interface org.hibernate.metamodel.mapping.FilterRestrictable
applyFilterRestrictions
Methods inherited from interface org.hibernate.metamodel.mapping.JdbcMappingContainer
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, isAffectedByEnabledFilters
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
areEqual, asAttributeMapping, asBasicValuedModelPart, breakDownJdbcValues, decompose, decompose, forEachSelectable, isEntityIdentifierMapping, isVirtual
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPartContainer
findByPath, findByPath, forEachSubPart
Methods inherited from interface org.hibernate.sql.model.MutationTarget
getRolePath
Methods inherited from interface org.hibernate.metamodel.mapping.Restrictable
applyBaseRestrictions
-
Field Details
-
ENTITY_CLASS
- See Also:
-
VERSION_COLUMN_ALIAS
- See Also:
-
ROWID_ALIAS
- See Also:
-
batchSize
protected final int batchSize -
rowIdName
-
insertGeneratedProperties
-
updateGeneratedProperties
-
declaredAttributeMappings
-
staticFetchableList
-
accessOptimizer
-
fullDiscriminatorSQLValues
-
insertExpectations
Deprecated. -
updateExpectations
Deprecated. -
deleteExpectations
Deprecated. -
insertCallable
Deprecated. -
updateCallable
Deprecated. -
deleteCallable
Deprecated. -
customSQLInsert
Deprecated. -
customSQLUpdate
Deprecated. -
customSQLDelete
Deprecated.
-
-
Constructor Details
-
AbstractEntityPersister
public AbstractEntityPersister(PersistentClass persistentClass, EntityDataAccess cacheAccessStrategy, NaturalIdDataAccess naturalIdRegionAccessStrategy, RuntimeModelCreationContext creationContext) throws HibernateException - Throws:
HibernateException
-
-
Method Details
-
buildSingleIdEntityLoader
For Hibernate Reactive -
getEntityNameByTableNameMap
public static Map<String,String> getEntityNameByTableNameMap(PersistentClass persistentClass, SqlStringGenerationContext stringGenerationContext) -
buildMultiIdLoader
-
getSubclassTableNames
-
getSubclassTableKeyColumns
-
isClassOrSuperclassTable
protected abstract boolean isClassOrSuperclassTable(int j) -
isClassOrSuperclassJoin
protected boolean isClassOrSuperclassJoin(int j) -
isPropertyOfTable
public abstract boolean isPropertyOfTable(int property, int j) -
getPropertyTableNumbers
protected abstract int[] getPropertyTableNumbers() -
getDiscriminatorColumnName
- Specified by:
getDiscriminatorColumnName
in interfaceEntityPersister
- Returns:
- the column name for the discriminator as specified in the mapping.
-
getDiscriminatorColumnReaders
-
getDiscriminatorColumnReaderTemplate
-
getDiscriminatorFormulaTemplate
-
isInverseTable
public boolean isInverseTable(int j) - Specified by:
isInverseTable
in interfaceEntityPersister
-
isNullableTable
public boolean isNullableTable(int j) - Specified by:
isNullableTable
in interfaceEntityPersister
-
isNullableSubclassTable
protected boolean isNullableSubclassTable(int j) -
isSubclassEntityName
Description copied from interface:EntityPersister
Determine whether the given name represents a subclass entity (or this entity itself) of the entity mapped by this persister.- Specified by:
isSubclassEntityName
in interfaceEntityPersister
- 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.
-
getRootTableKeyColumnNames
Description copied from interface:EntityPersister
The names of the primary key columns in the root table.- Specified by:
getRootTableKeyColumnNames
in interfaceEntityPersister
- Returns:
- The primary key column names.
-
getInsertCoordinator
Description copied from interface:EntityPersister
Get the insert coordinator instance.- Specified by:
getInsertCoordinator
in interfaceEntityPersister
-
getUpdateCoordinator
Description copied from interface:EntityPersister
Get the update coordinator instance.- Specified by:
getUpdateCoordinator
in interfaceEntityPersister
-
getDeleteCoordinator
Description copied from interface:EntityPersister
Get the delete coordinator instance.- Specified by:
getDeleteCoordinator
in interfaceEntityPersister
-
getMergeCoordinator
Description copied from interface:EntityPersister
Get the merge coordinator instance.- Specified by:
getMergeCoordinator
in interfaceEntityPersister
-
getVersionSelectString
-
getInsertGeneratedValuesProcessor
-
getUpdateGeneratedValuesProcessor
-
hasRowId
public boolean hasRowId()Description copied from interface:EntityPersister
Does the result set contain rowids?- Specified by:
hasRowId
in interfaceEntityPersister
-
getTableNames
- Specified by:
getTableNames
in interfaceEntityPersister
-
buildCacheEntryHelper
protected AbstractEntityPersister.CacheEntryHelper buildCacheEntryHelper(SessionFactoryOptions options) -
canUseReferenceCacheEntries
public boolean canUseReferenceCacheEntries()- Specified by:
canUseReferenceCacheEntries
in interfaceEntityPersister
-
useShallowQueryCacheLayout
public boolean useShallowQueryCacheLayout()- Specified by:
useShallowQueryCacheLayout
in interfaceEntityPersister
-
storeDiscriminatorInShallowQueryCacheLayout
public boolean storeDiscriminatorInShallowQueryCacheLayout()- Specified by:
storeDiscriminatorInShallowQueryCacheLayout
in interfaceEntityPersister
-
hasFilterForLoadByKey
public boolean hasFilterForLoadByKey()- Specified by:
hasFilterForLoadByKey
in interfaceEntityPersister
-
uniqueKeyEntries
- Specified by:
uniqueKeyEntries
in interfaceEntityPersister
- Returns:
- Metadata for each unique key defined
-
getLazyLoadPlanByFetchGroup
-
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 interfaceEntityPersister
- Specified by:
getSqlAliasStem
in interfaceTableGroupProducer
- See Also:
-
containsTableReference
- Specified by:
containsTableReference
in interfaceTableGroupProducer
-
getPartName
Description copied from interface:ModelPart
The local part name, which is generally the unqualified role name- Specified by:
getPartName
in interfaceEntityMappingType
- Specified by:
getPartName
in interfaceModelPart
-
getNaturalIdMapping
Description copied from interface:EntityMappingType
The mapping for the natural-id of the entity, if one is defined- Specified by:
getNaturalIdMapping
in interfaceEntityMappingType
-
createPrimaryTableReference
public TableReference createPrimaryTableReference(SqlAliasBase sqlAliasBase, SqlAstCreationState sqlAstCreationState) - Specified by:
createPrimaryTableReference
in interfaceEntityMappingType
-
createTableReferenceJoin
public TableReferenceJoin createTableReferenceJoin(String joinTableExpression, SqlAliasBase sqlAliasBase, TableReference lhs, SqlAstCreationState creationState) - Specified by:
createTableReferenceJoin
in interfaceEntityMappingType
-
generateTableReferenceJoin
protected TableReferenceJoin generateTableReferenceJoin(TableReference lhs, String joinTableExpression, SqlAliasBase sqlAliasBase, boolean innerJoin, String[] targetColumns, SqlAstCreationState creationState) -
generateJoinPredicate
protected Predicate generateJoinPredicate(TableReference rootTableReference, TableReference joinedTableReference, String[] pkColumnNames, String[] fkColumnNames, SqlAstCreationState creationState) -
initializeLazyProperty
protected boolean initializeLazyProperty(String fieldName, Object entity, EntityEntry entry, int index, Object propValue) Called by Hibernate Reactive -
initializeLazyProperty
protected boolean initializeLazyProperty(String fieldName, Object entity, EntityEntry entry, LazyAttributeDescriptor fetchGroupAttributeDescriptor, Object propValue) -
getQuerySpaces
Description copied from interface:EntityPersister
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
EntityPersister.getPropertySpaces()
, except that here we include subclass entity spaces.- Specified by:
getQuerySpaces
in interfaceEntityPersister
- Returns:
- The query spaces.
-
getBatchSize
public int getBatchSize()Description copied from interface:EntityPersister
The batch size for batch loading.- Specified by:
getBatchSize
in interfaceEntityPersister
- Specified by:
getBatchSize
in interfaceLoadable
- See Also:
-
getIdentifierColumnNames
Description copied from interface:EntityPersister
Get the names of columns used to persist the identifier- Specified by:
getIdentifierColumnNames
in interfaceEntityPersister
-
getIdentifierColumnReaders
-
getIdentifierColumnReaderTemplates
-
getIdentifierColumnSpan
public int getIdentifierColumnSpan() -
getIdentifierAliases
-
getVersionColumnName
Description copied from interface:EntityPersister
For versioned entities, get the name of the column (again, expected on the root table) used to store the version values.- Specified by:
getVersionColumnName
in interfaceEntityPersister
- Returns:
- The version column name.
-
getVersionedTableName
-
isCacheInvalidationRequired
public boolean isCacheInvalidationRequired()We can't immediately add to the cache if we have formulas which must be evaluated, or if we have the possibility of two concurrent updates to the same item being merged on the database. This second case can happen if:- the item is not versioned, and either
- we have dynamic update enabled, or
- the state of the item spans multiple tables.
- Specified by:
isCacheInvalidationRequired
in interfaceEntityPersister
-
isLazyPropertiesCacheable
public boolean isLazyPropertiesCacheable()Description copied from interface:EntityPersister
Should lazy properties of this entity be cached?- Specified by:
isLazyPropertiesCacheable
in interfaceEntityPersister
-
selectFragment
Description copied from interface:EntityPersister
All columns to select, when loading.- Specified by:
selectFragment
in interfaceEntityPersister
-
getIdentifierAliases
Description copied from interface:EntityPersister
Get the result set aliases used for the identifier columns, given a suffix- Specified by:
getIdentifierAliases
in interfaceEntityPersister
-
getPropertyAliases
Description copied from interface:EntityPersister
Get the result set aliases used for the property columns, given a suffix (properties of this class, only).- Specified by:
getPropertyAliases
in interfaceEntityPersister
-
getDiscriminatorAlias
Description copied from interface:EntityPersister
Get the result set aliases used for the identifier columns, given a suffix- Specified by:
getDiscriminatorAlias
in interfaceEntityPersister
-
generateSelectVersionString
Generate the SQL that selects the version number by id -
createGeneratedValuesProcessor
protected GeneratedValuesProcessor createGeneratedValuesProcessor(EventType timing, List<AttributeMapping> generatedAttributes) -
getJdbcMapping
- Specified by:
getJdbcMapping
in interfaceJdbcMappingContainer
-
generateLocker
-
lock
public void lock(Object id, Object version, Object object, LockMode lockMode, EventSource session) throws HibernateException Description copied from interface:EntityPersister
Do a version check (optional operation)- Specified by:
lock
in interfaceEntityPersister
- Throws:
HibernateException
-
lock
public void lock(Object id, Object version, Object object, LockOptions lockOptions, EventSource session) throws HibernateException Description copied from interface:EntityPersister
Do a version check (optional operation)- Specified by:
lock
in interfaceEntityPersister
- Throws:
HibernateException
-
getRootTableName
Description copied from interface:EntityPersister
Locks are always applied to the "root table".- Specified by:
getRootTableName
in interfaceEntityPersister
- Returns:
- The root table name
-
getRootTableIdentifierColumnNames
Description copied from interface:EntityPersister
Get the names of columns on the root table used to persist the identifier.- Specified by:
getRootTableIdentifierColumnNames
in interfaceEntityPersister
- Returns:
- The root table identifier column names.
-
toColumns
Given a property path, return the corresponding column name(s). Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).- Specified by:
toColumns
in interfaceEntityPersister
- Throws:
QueryException
-
getPropertyColumnNames
Get the column names for the given property path Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).- Specified by:
getPropertyColumnNames
in interfaceEntityPersister
-
getSubclassPropertyTableNumber
Warning: When there are duplicated property names in the subclasses of the class, this method may return the wrong table number for the duplicated subclass property. Note that SingleTableEntityPersister defines an overloaded form which takes the entity name. -
resolveDiscriminatorType
-
getTypeDiscriminatorMetadata
Description copied from interface:EntityPersister
Retrieve the information needed to properly deal with this entity's discriminator in a query.- Specified by:
getTypeDiscriminatorMetadata
in interfaceEntityPersister
- Returns:
- The entity discriminator metadata
-
generateTableAlias
-
getPropertyColumnNames
-
hasFormulaProperties
public boolean hasFormulaProperties() -
getFetchMode
-
getSubclassPropertyType
-
countSubclassProperties
public int countSubclassProperties()- Specified by:
countSubclassProperties
in interfaceEntityPersister
-
getSubclassPropertyColumnNames
- Specified by:
getSubclassPropertyColumnNames
in interfaceEntityPersister
-
getSubclassPropertyFormulaTemplateClosure
-
getSubclassPropertyTypeClosure
-
getSubclassPropertyColumnNameClosure
-
getSubclassPropertyColumnReaderClosure
-
getSubclassPropertyColumnReaderTemplateClosure
-
getSubclassPropertyNameClosure
-
resolveAttributeIndexes
Description copied from interface:EntityPersister
Converts an array of attribute names to a set of indexes, according to the entity metamodel- Specified by:
resolveAttributeIndexes
in interfaceEntityPersister
- Parameters:
attributeNames
- Array of names to be resolved- Returns:
- A set of unique indexes of the attribute names found in the metamodel
-
resolveDirtyAttributeIndexes
public int[] resolveDirtyAttributeIndexes(Object[] currentState, Object[] previousState, String[] attributeNames, SessionImplementor session) Description copied from interface:EntityPersister
LikeEntityPersister.resolveAttributeIndexes(String[])
but also always returns mutable attributes- Specified by:
resolveDirtyAttributeIndexes
in interfaceEntityPersister
attributeNames
- Array of names to be resolved- Returns:
- A set of unique indexes of the attribute names found in the metamodel
-
getPropertyIndex
- Specified by:
getPropertyIndex
in interfaceAttributeSource
-
initPropertyPaths
- Throws:
MappingException
-
getIdentitySelectString
Description copied from interface:EntityPersister
Get the database-specific SQL command to retrieve the last generated IDENTITY value.- Specified by:
getIdentitySelectString
in interfaceEntityPersister
- Returns:
- The SQL command string
-
getSelectByUniqueKeyString
Description copied from interface:EntityPersister
Get a SQL select string that performs a select based on a unique key determined by the given property name.- Specified by:
getSelectByUniqueKeyString
in interfaceEntityPersister
- 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
Description copied from interface:EntityPersister
Get a SQL select string that performs a select based on a unique key determined by the given property names.- Specified by:
getSelectByUniqueKeyString
in interfaceEntityPersister
- 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
- Specified by:
getSelectByUniqueKeyString
in interfaceEntityPersister
-
getInsertDelegate
- Specified by:
getInsertDelegate
in interfaceEntityMutationTarget
-
getUpdateDelegate
- Specified by:
getUpdateDelegate
in interfaceEntityMutationTarget
-
getTableMappings
- Specified by:
getTableMappings
in interfaceEntityMutationTarget
-
getTableMapping
-
physicalTableNameForMutation
Unfortunately we cannot directly use `SelectableMapping#getContainingTableExpression()` as that blows up for attributes declared on super-type for union-subclass mappings- Specified by:
physicalTableNameForMutation
in interfaceEntityMutationTarget
-
getTargetPart
Description copied from interface:MutationTarget
The ModelPart describing the mutation target- Specified by:
getTargetPart
in interfaceEntityMutationTarget
- Specified by:
getTargetPart
in interfaceMutationTarget<EntityTableMapping>
-
forEachMutableTable
Description copied from interface:MutationTarget
Visit each table.- Specified by:
forEachMutableTable
in interfaceMutationTarget<EntityTableMapping>
-
forEachMutableTableReverse
Description copied from interface:MutationTarget
Same asMutationTarget.forEachMutableTable(java.util.function.Consumer<T>)
except that here the tables are visited in reverse order- Specified by:
forEachMutableTableReverse
in interfaceMutationTarget<EntityTableMapping>
-
getIdentifierTableName
Description copied from interface:MutationTarget
The name of the table defining the identifier for this target- Specified by:
getIdentifierTableName
in interfaceMutationTarget<EntityTableMapping>
-
getIdentifierTableMapping
Description copied from interface:MutationTarget
The descriptor for the table containing the identifier for the target- Specified by:
getIdentifierTableMapping
in interfaceEntityMutationTarget
- Specified by:
getIdentifierTableMapping
in interfaceMutationTarget<EntityTableMapping>
-
getIdentifierDescriptor
Description copied from interface:EntityMutationTarget
The ModelPart describing the identifier/key for this target- Specified by:
getIdentifierDescriptor
in interfaceEntityMutationTarget
-
logStaticSQL
protected void logStaticSQL() -
getSubclassByDiscriminatorValue
-
getConstraintOrderedTableNameClosure
-
needsDiscriminator
public abstract boolean needsDiscriminator() -
isDiscriminatorFormula
protected boolean isDiscriminatorFormula() -
applyDiscriminator
public void applyDiscriminator(Consumer<Predicate> predicateConsumer, String alias, TableGroup tableGroup, SqlAstCreationState creationState) Description copied from interface:Discriminable
Apply the discriminator as a predicate via thepredicateConsumer
- Specified by:
applyDiscriminator
in interfaceDiscriminable
- Specified by:
applyDiscriminator
in interfaceEntityMappingType
-
getPrunedDiscriminatorPredicate
protected String getPrunedDiscriminatorPredicate(Map<String, EntityNameUse> entityNameUses, MappingMetamodelImplementor mappingMetamodel, String alias) -
applyFilterRestrictions
public void applyFilterRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String, Filter> enabledFilters, boolean onlyApplyLoadByKeyFilters, SqlAstCreationState creationState) Description copied from interface:FilterRestrictable
Applies just theFilter
values enabled for the associated entity- Specified by:
applyFilterRestrictions
in interfaceEntityMappingType
- Specified by:
applyFilterRestrictions
in interfaceFilterRestrictable
-
applyBaseRestrictions
public void applyBaseRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String, Filter> enabledFilters, boolean onlyApplyLoadByKeyFilters, Set<String> treatAsDeclarations, SqlAstCreationState creationState) Description copied from interface:Restrictable
Applies the base set of restrictions.- Specified by:
applyBaseRestrictions
in interfaceEntityMappingType
- Specified by:
applyBaseRestrictions
in interfaceRestrictable
-
hasWhereRestrictions
public boolean hasWhereRestrictions()Description copied from interface:WhereRestrictable
Does this restrictable have a where restriction?- Specified by:
hasWhereRestrictions
in interfaceEntityMappingType
- Specified by:
hasWhereRestrictions
in interfaceWhereRestrictable
-
applyWhereRestrictions
public void applyWhereRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, SqlAstCreationState creationState) Description copied from interface:WhereRestrictable
Apply theSQLRestriction
restrictions- Specified by:
applyWhereRestrictions
in interfaceEntityMappingType
- Specified by:
applyWhereRestrictions
in interfaceWhereRestrictable
-
shouldInnerJoinSubclassTable
-
isSubclassTableIndicatedByTreatAsDeclarations
-
postConstruct
Post-construct is a callback for AbstractEntityPersister subclasses to call after they are all done with their constructor processing. It allows AbstractEntityPersister to extend its construction after all subclass-specific details have been handled.- Parameters:
mapping
- The mapping- Throws:
MappingException
- Indicates a problem accessing the Mapping
-
prepareLoaders
public void prepareLoaders()Description copied from interface:EntityPersister
Prepare loaders associated with the persister. Distinct "phase" in building the persister after InFlightEntityMappingType.prepareMappingModel(org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess) and EntityPersister.postInstantiate() have occurred. The distinct phase is used to ensure that all TableDetails are available across the entire model- Specified by:
prepareLoaders
in interfaceEntityPersister
-
createInsertDelegate
-
createUpdateDelegate
-
buildTableMappings
Builds the EntityTableMapping descriptors for the tables mapped by this entity. -
visitMutabilityOrderedTables
protected abstract void visitMutabilityOrderedTables(org.hibernate.persister.entity.AbstractEntityPersister.MutabilityOrderedTableConsumer consumer) Visit details about each table for this entity, using "mutability ordering". When inserting rows, the order we go through the tables to avoid foreign key problems among the entity's group of tables.Used while building the table mapping descriptors for each table.
-
isIdentifierTable
-
buildInsertCoordinator
-
buildUpdateCoordinator
-
buildMergeCoordinator
-
buildDeleteCoordinator
-
addDiscriminatorToInsertGroup
- Specified by:
addDiscriminatorToInsertGroup
in interfaceEntityMutationTarget
-
addSoftDeleteToInsertGroup
- Specified by:
addSoftDeleteToInsertGroup
in interfaceEntityMutationTarget
-
substituteBrackets
-
postInstantiate
Description copied from interface:EntityPersister
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.- Specified by:
postInstantiate
in interfaceEntityPersister
- Throws:
MappingException
- Indicates an issue in the metadata.
-
getSingleIdLoader
-
multiLoad
Description copied from interface:EntityPersister
Performs a load of multiple entities (of this type) by identifier simultaneously.- Specified by:
multiLoad
in interfaceEntityPersister
- Parameters:
ids
- The identifiers to loadsession
- The originating SessionloadOptions
- The options for loading- Returns:
- The loaded, matching entities
-
registerAffectingFetchProfile
Description copied from interface:FetchProfileAffectee
Register the profile name with the entity/collection- Specified by:
registerAffectingFetchProfile
in interfaceFetchProfileAffectee
-
isAffectedByEntityGraph
Description copied from interface:Loadable
Whether the effective entity-graph applies to this loadable- Specified by:
isAffectedByEntityGraph
in interfaceEntityMappingType
- Specified by:
isAffectedByEntityGraph
in interfaceLoadable
-
isAffectedByEnabledFetchProfiles
Description copied from interface:Loadable
Whether any of the LoadQueryInfluencers.getEnabledFetchProfileNames() apply to this loadable- Specified by:
isAffectedByEnabledFetchProfiles
in interfaceEntityMappingType
- Specified by:
isAffectedByEnabledFetchProfiles
in interfaceLoadable
-
isAffectedByEnabledFilters
public boolean isAffectedByEnabledFilters(LoadQueryInfluencers loadQueryInfluencers, boolean onlyApplyForLoadByKeyFilters) Description copied from interface:Loadable
Whether any of the "influencers" affect this loadable.- Specified by:
isAffectedByEnabledFilters
in interfaceEntityMappingType
- Specified by:
isAffectedByEnabledFilters
in interfaceLoadable
-
getPropertyUpdateability
Which properties appear in the SQL update? (Initialized, updateable ones!) -
getFactory
Description copied from interface:EntityPersister
Return theSessionFactory
to which this persister belongs.- Specified by:
getFactory
in interfaceEntityPersister
- Returns:
- The owning
SessionFactory
.
-
getEntityMetamodel
Description copied from interface:EntityPersister
Retrieve the underlying entity metamodel instance.- Specified by:
getEntityMetamodel
in interfaceEntityPersister
- Returns:
- The metamodel
-
canReadFromCache
public boolean canReadFromCache()- Specified by:
canReadFromCache
in interfaceEntityPersister
-
canWriteToCache
public boolean canWriteToCache()- Specified by:
canWriteToCache
in interfaceEntityPersister
-
hasCache
public boolean hasCache()Description copied from interface:EntityPersister
Does this class have a cache.- Specified by:
hasCache
in interfaceEntityPersister
-
getCacheAccessStrategy
Description copied from interface:EntityPersister
Get the cache (optional operation)- Specified by:
getCacheAccessStrategy
in interfaceEntityPersister
-
getCacheEntryStructure
Description copied from interface:EntityPersister
Get the cache structure- Specified by:
getCacheEntryStructure
in interfaceEntityPersister
-
hasNaturalIdCache
public boolean hasNaturalIdCache()Description copied from interface:EntityPersister
Does this class have a natural id cache- Specified by:
hasNaturalIdCache
in interfaceEntityPersister
-
getNaturalIdCacheAccessStrategy
Description copied from interface:EntityPersister
Get the NaturalId cache (optional operation)- Specified by:
getNaturalIdCacheAccessStrategy
in interfaceEntityPersister
-
getEntityName
Description copied from interface:EntityPersister
The entity name which this persister maps.- Specified by:
getEntityName
in interfaceEntityMappingType
- Specified by:
getEntityName
in interfaceEntityPersister
- Returns:
- The name of the entity which this persister maps.
-
getJpaEntityName
Description copied from interface:EntityPersister
The JPA entity name, if one, associated with the entity.- Specified by:
getJpaEntityName
in interfaceEntityPersister
-
isInherited
public boolean isInherited()Description copied from interface:EntityPersister
Determine whether the entity is inherited one or more other entities. In other words, is this entity a subclass of other entities.- Specified by:
isInherited
in interfaceEntityPersister
- Returns:
- True if other entities extend this entity; false otherwise.
-
hasCascades
public boolean hasCascades()Description copied from interface:EntityPersister
Determine whether this entity has any (non-none) cascading.- Specified by:
hasCascades
in interfaceEntityPersister
- Returns:
- True if the entity has any properties with a cascade other than NONE; false otherwise (aka, no cascading).
-
hasCascadeDelete
public boolean hasCascadeDelete()Description copied from interface:EntityPersister
Determine whether this entity has any delete cascading.- Specified by:
hasCascadeDelete
in interfaceEntityPersister
- Returns:
- True if the entity has any properties with a cascade other than NONE; false otherwise.
-
hasOwnedCollections
public boolean hasOwnedCollections()Description copied from interface:EntityPersister
Determine whether this entity has any owned collections.- Specified by:
hasOwnedCollections
in interfaceEntityPersister
- Returns:
- True if the entity has an owned collection; false otherwise.
-
hasIdentifierProperty
public boolean hasIdentifierProperty()Description copied from interface:EntityPersister
Determine whether the entity has a particular property holding the identifier value.- Specified by:
hasIdentifierProperty
in interfaceEntityPersister
- Returns:
- True if the entity has a specific property holding identifier value.
-
getVersionType
Description copied from interface:EntityPersister
IfEntityPersister.isVersioned()
, then what is the type of the property holding the locking value.- Specified by:
getVersionType
in interfaceEntityPersister
- Returns:
- The type of the version property; or null, if not versioned.
-
getVersionProperty
public int getVersionProperty()Description copied from interface:EntityPersister
IfEntityPersister.isVersioned()
, then what is the index of the property holding the locking value.- Specified by:
getVersionProperty
in interfaceEntityPersister
- Returns:
- The type of the version property; or -66, if not versioned.
-
isVersioned
public boolean isVersioned()Description copied from interface:EntityPersister
Determine whether optimistic locking by column is enabled for this entity.- Specified by:
isVersioned
in interfaceEntityPersister
- Returns:
- True if optimistic locking by column (i.e.,
<version/>
or<timestamp/>
) is enabled; false otherwise.
-
isIdentifierAssignedByInsert
public boolean isIdentifierAssignedByInsert()Description copied from interface:EntityPersister
Are identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.- Specified by:
isIdentifierAssignedByInsert
in interfaceEntityPersister
- Returns:
- True if identifiers for this entity are generated by the insert execution.
-
hasLazyProperties
public boolean hasLazyProperties()Description copied from interface:EntityPersister
Determine whether this entity defines any lazy properties (when bytecode instrumentation is enabled).- Specified by:
hasLazyProperties
in interfaceEntityPersister
- Returns:
- True if the entity has properties mapped as lazy; false otherwise.
-
hasCollections
public boolean hasCollections()Description copied from interface:EntityPersister
Determine whether this entity contains references to persistent collections.- Specified by:
hasCollections
in interfaceEntityPersister
- Returns:
- True if the entity does contain persistent collections; false otherwise.
-
hasMutableProperties
public boolean hasMutableProperties()Description copied from interface:EntityPersister
Determine whether any properties of this entity are considered mutable.- Specified by:
hasMutableProperties
in interfaceEntityPersister
- Returns:
- True if any properties of the entity are mutable; false otherwise (meaning none are).
-
isMutable
public boolean isMutable()Description copied from interface:EntityPersister
Determine whether instances of this entity are considered mutable.- Specified by:
isMutable
in interfaceEntityPersister
- Returns:
- True if the entity is considered mutable; false otherwise.
-
isAbstract
public boolean isAbstract()Description copied from interface:EntityMappingType
Whether this entity is defined as abstract using the Javaabstract
keyword- Specified by:
isAbstract
in interfaceEntityMappingType
-
hasSubclasses
public boolean hasSubclasses()Description copied from interface:EntityMappingType
Whether this entity mapping has any subtype mappings- Specified by:
hasSubclasses
in interfaceEntityMappingType
-
hasProxy
public boolean hasProxy()Description copied from interface:EntityPersister
Determine whether this entity supports dynamic proxies.- Specified by:
hasProxy
in interfaceEntityPersister
- Returns:
- True if the entity has dynamic proxy support; false otherwise.
-
getIdentifierGenerator
Deprecated.Description copied from interface:EntityPersister
Determine which identifier generation strategy is used for this entity.- Specified by:
getIdentifierGenerator
in interfaceEntityPersister
- Returns:
- The identifier generation strategy.
- Throws:
HibernateException
-
getGenerator
- Specified by:
getGenerator
in interfaceEntityPersister
-
getVersionGenerator
- Specified by:
getVersionGenerator
in interfaceEntityPersister
-
getRootEntityName
Description copied from interface:EntityPersister
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.- Specified by:
getRootEntityName
in interfaceEntityPersister
- Returns:
- The root entity name.
-
getMappedSuperclass
Description copied from interface:EntityMappingType
Get the name of the entity that is the "super class" for this entity- Specified by:
getMappedSuperclass
in interfaceEntityMappingType
- See Also:
-
isExplicitPolymorphism
public boolean isExplicitPolymorphism()Description copied from interface:EntityMappingType
Is this class explicit polymorphism only?- Specified by:
isExplicitPolymorphism
in interfaceEntityMappingType
-
isConcreteProxy
public boolean isConcreteProxy()Description copied from interface:EntityMappingType
Returnstrue
if this entity type's hierarchy is configured to return concrete-typed proxies.- Specified by:
isConcreteProxy
in interfaceEntityMappingType
- See Also:
-
getPropertyType
Deprecated.by the supertypesGet the type of a particular property by name. Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).- Specified by:
getPropertyType
in interfaceEntityPersister
- Parameters:
propertyName
- The name of the property for which to retrieve the type.- Returns:
- The type.
- Throws:
MappingException
- Typically indicates an unknown property name.
-
isSelectBeforeUpdateRequired
public boolean isSelectBeforeUpdateRequired()Description copied from interface:EntityPersister
Is select snapshot before update enabled?- Specified by:
isSelectBeforeUpdateRequired
in interfaceEntityPersister
-
optimisticLockStyle
Description copied from interface:EntityMappingType
The type of optimistic locking, if any, defined for this entity mapping- Specified by:
optimisticLockStyle
in interfaceEntityMappingType
-
toString
-
isInstrumented
public boolean isInstrumented()Description copied from interface:EntityPersister
Has the class actually been bytecode instrumented?- Specified by:
isInstrumented
in interfaceEntityPersister
-
hasInsertGeneratedProperties
public boolean hasInsertGeneratedProperties()Description copied from interface:EntityPersister
Does this entity define any properties as being database generated on insert?- Specified by:
hasInsertGeneratedProperties
in interfaceEntityPersister
- Returns:
- True if this entity contains at least one property defined as generated (including version property, but not identifier).
-
hasUpdateGeneratedProperties
public boolean hasUpdateGeneratedProperties()Description copied from interface:EntityPersister
Does this entity define any properties as being database generated on update?- Specified by:
hasUpdateGeneratedProperties
in interfaceEntityPersister
- Returns:
- True if this entity contains at least one property defined as generated (including version property, but not identifier).
-
isVersionPropertyGenerated
public boolean isVersionPropertyGenerated()Description copied from interface:EntityPersister
Does this entity contain a version property that is defined to be database generated?- Specified by:
isVersionPropertyGenerated
in interfaceEntityPersister
- Returns:
- true if this entity contains a version property and that property has been marked as generated.
-
isVersionGeneratedOnExecution
public boolean isVersionGeneratedOnExecution() -
isVersionGeneratedBeforeExecution
public boolean isVersionGeneratedBeforeExecution() -
getPropertyNames
Description copied from interface:EntityPersister
Get the names of the class properties - doesn't have to be the names of the actual Java properties (used for XML generation only)- Specified by:
getPropertyNames
in interfaceEntityPersister
-
getPropertyTypes
Description copied from interface:EntityPersister
Get the Hibernate types of the class properties- Specified by:
getPropertyTypes
in interfaceEntityPersister
-
getPropertyLaziness
public boolean[] getPropertyLaziness()- Specified by:
getPropertyLaziness
in interfaceEntityPersister
-
getPropertyUpdateability
public boolean[] getPropertyUpdateability()Description copied from interface:EntityPersister
Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)- Specified by:
getPropertyUpdateability
in interfaceEntityPersister
-
getPropertyCheckability
public boolean[] getPropertyCheckability()Description copied from interface:EntityPersister
Get the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated)- Specified by:
getPropertyCheckability
in interfaceEntityPersister
-
getNonLazyPropertyUpdateability
public boolean[] getNonLazyPropertyUpdateability()- Specified by:
getNonLazyPropertyUpdateability
in interfaceEntityPersister
-
getPropertyInsertability
public boolean[] getPropertyInsertability()Description copied from interface:EntityPersister
Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT)- Specified by:
getPropertyInsertability
in interfaceEntityPersister
-
getPropertyNullability
public boolean[] getPropertyNullability()Description copied from interface:EntityPersister
Get the nullability of the properties of this class- Specified by:
getPropertyNullability
in interfaceEntityPersister
-
getPropertyVersionability
public boolean[] getPropertyVersionability()Description copied from interface:EntityPersister
Get the "versionability" of the properties of this class (is the property optimistic-locked)- Specified by:
getPropertyVersionability
in interfaceEntityPersister
-
getPropertyCascadeStyles
Description copied from interface:EntityPersister
Get the cascade styles of the properties (optional operation)- Specified by:
getPropertyCascadeStyles
in interfaceEntityPersister
-
isPropertySelectable
public boolean isPropertySelectable(int propertyNumber) - Specified by:
isPropertySelectable
in interfaceEntityPersister
-
getMappedClass
Description copied from interface:EntityPersister
The persistent class, or null- Specified by:
getMappedClass
in interfaceEntityPersister
-
getConcreteProxyClass
Description copied from interface:EntityPersister
Get the proxy interface that instances of this concrete class will be cast to (optional operation).- Specified by:
getConcreteProxyClass
in interfaceEntityPersister
-
setPropertyValues
Description copied from interface:EntityPersister
Set the given values to the mapped properties of the given object.- Specified by:
setPropertyValues
in interfaceEntityPersister
-
setPropertyValue
Description copied from interface:EntityPersister
Set the value of a particular property of the given instance.- Specified by:
setPropertyValue
in interfaceEntityPersister
-
getPropertyValues
- Specified by:
getPropertyValues
in interfaceEntityPersister
-
getPropertyValue
- Specified by:
getPropertyValue
in interfaceEntityPersister
-
getPropertyValue
Description copied from interface:EntityPersister
Get the value of a particular property- Specified by:
getPropertyValue
in interfaceEntityPersister
-
getIdentifier
Description copied from interface:EntityPersister
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- Specified by:
getIdentifier
in interfaceEntityPersister
-
getVersion
Description copied from interface:EntityPersister
Get the version number (or timestamp) from the object's version property. Returnnull
if it is not versioned.- Specified by:
getVersion
in interfaceEntityPersister
-
isInstance
Description copied from interface:EntityPersister
Is the given object an instance of this entity?- Specified by:
isInstance
in interfaceEntityPersister
-
hasUninitializedLazyProperties
Description copied from interface:EntityPersister
Does the given instance have any uninitialized lazy properties?- Specified by:
hasUninitializedLazyProperties
in interfaceEntityPersister
-
getSubclassEntityPersister
public EntityPersister getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory) Description copied from interface:EntityPersister
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.- Specified by:
getSubclassEntityPersister
in interfaceEntityPersister
- Parameters:
instance
- The entity instancefactory
- Reference to the SessionFactory- Returns:
- The appropriate persister
-
hasMultipleTables
public boolean hasMultipleTables()- Specified by:
hasMultipleTables
in interfaceEntityPersister
-
getPropertySpan
public int getPropertySpan() -
shouldGetAllProperties
-
initInsertGeneratedProperties
protected List<? extends ModelPart> initInsertGeneratedProperties(List<AttributeMapping> generatedAttributes) -
getInsertGeneratedProperties
- Specified by:
getInsertGeneratedProperties
in interfaceEntityPersister
-
initUpdateGeneratedProperties
protected List<? extends ModelPart> initUpdateGeneratedProperties(List<AttributeMapping> generatedAttributes) -
getUpdateGeneratedProperties
- Specified by:
getUpdateGeneratedProperties
in interfaceEntityPersister
-
getIdentifierPropertyName
Description copied from interface:EntityPersister
Get the name of the identifier property (or return null) - need not return the name of an actual Java property- Specified by:
getIdentifierPropertyName
in interfaceEntityPersister
-
getIdentifierType
Description copied from interface:EntityPersister
Get the identifier type- Specified by:
getIdentifierType
in interfaceEntityPersister
-
hasSubselectLoadableCollections
public boolean hasSubselectLoadableCollections()Description copied from interface:EntityPersister
Determine whether this entity contains references to persistent collections which are fetchable by subselect?- Specified by:
hasSubselectLoadableCollections
in interfaceEntityPersister
- Returns:
- True if the entity contains collections fetchable by subselect; false otherwise.
-
hasCollectionNotReferencingPK
public boolean hasCollectionNotReferencingPK()Description copied from interface:EntityPersister
Determine whether this entity contains references to persistent collections not referencing the primary key.- Specified by:
hasCollectionNotReferencingPK
in interfaceEntityPersister
- Returns:
- True if the entity contains a collection not referencing the primary key; false otherwise.
-
getNaturalIdentifierProperties
public int[] getNaturalIdentifierProperties()Description copied from interface:EntityPersister
If the entity defines a natural id, that is, ifEntityPersister.hasNaturalIdentifier()
returnstrue
, the indices of the properties which make up the natural id.- Specified by:
getNaturalIdentifierProperties
in interfaceEntityPersister
- Returns:
- The indices of the properties making up the natural id; or null, if no natural id is defined.
-
verifyHasNaturalId
protected void verifyHasNaturalId() -
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
- Specified by:
getNaturalIdLoader
in interfaceEntityPersister
-
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
- Specified by:
getMultiNaturalIdLoader
in interfaceEntityPersister
-
hasNaturalIdentifier
public boolean hasNaturalIdentifier()Description copied from interface:EntityPersister
Determine whether this entity defines a natural identifier.- Specified by:
hasNaturalIdentifier
in interfaceEntityPersister
- Returns:
- True if the entity defines a natural id; false otherwise.
-
getTableId
-
getRepresentationStrategy
Description copied from interface:EntityMappingType
Describes how the entity is represented in the application's domain model.- Specified by:
getRepresentationStrategy
in interfaceEntityMappingType
- Specified by:
getRepresentationStrategy
in interfaceEntityPersister
-
getInstrumentationMetadata
- Specified by:
getInstrumentationMetadata
in interfaceEntityPersister
-
getBytecodeEnhancementMetadata
- Specified by:
getBytecodeEnhancementMetadata
in interfaceEntityPersister
-
getTableNameForColumn
- Specified by:
getTableNameForColumn
in interfaceEntityPersister
-
determineTableNumberForColumn
-
determineTableName
-
getEntityEntryFactory
Description copied from interface:EntityPersister
Get the EntityEntryFactory indicated for the entity mapped by this persister.- Specified by:
getEntityEntryFactory
in interfaceEntityPersister
- Returns:
- The proper EntityEntryFactory.
-
forEachAttributeMapping
Description copied from interface:EntityMappingType
Visit each attribute mapping- Specified by:
forEachAttributeMapping
in interfaceEntityMappingType
- Specified by:
forEachAttributeMapping
in interfaceManagedMappingType
- See Also:
-
forEachAttributeMapping
Description copied from interface:ManagedMappingType
Visit attributes defined on this class and any supers- Specified by:
forEachAttributeMapping
in interfaceManagedMappingType
-
prepareMappingModel
Description copied from interface:InFlightEntityMappingType
After all hierarchy types have been linked, this method is called to allow the mapping model to be prepared which generally includes creating attribute mapping descriptors, identifier mapping descriptor, etc.- Specified by:
prepareMappingModel
in interfaceInFlightEntityMappingType
-
generateNaturalIdMapping
protected NaturalIdMapping generateNaturalIdMapping(MappingModelCreationProcess creationProcess, PersistentClass bootEntityDescriptor) -
interpretSqmMultiTableStrategy
protected static SqmMultiTableMutationStrategy interpretSqmMultiTableStrategy(AbstractEntityPersister entityMappingDescriptor, MappingModelCreationProcess creationProcess) -
interpretSqmMultiTableInsertStrategy
protected static SqmMultiTableInsertStrategy interpretSqmMultiTableInsertStrategy(AbstractEntityPersister entityMappingDescriptor, MappingModelCreationProcess creationProcess) -
getSqmMultiTableMutationStrategy
Description copied from interface:EntityPersister
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
- Specified by:
getSqmMultiTableMutationStrategy
in interfaceEntityPersister
-
getSqmMultiTableInsertStrategy
- Specified by:
getSqmMultiTableInsertStrategy
in interfaceEntityMappingType
- Specified by:
getSqmMultiTableInsertStrategy
in interfaceEntityPersister
-
getStateArrayInitialPosition
-
isPhysicalDiscriminator
protected boolean isPhysicalDiscriminator() -
generateDiscriminatorMapping
protected EntityDiscriminatorMapping generateDiscriminatorMapping(PersistentClass bootEntityDescriptor) -
getDiscriminatorType
Description copied from interface:EntityPersister
Get the discriminator type- Specified by:
getDiscriminatorType
in interfaceEntityPersister
-
generateVersionMapping
protected EntityVersionMapping generateVersionMapping(Supplier<?> templateInstanceCreator, PersistentClass bootEntityDescriptor, MappingModelCreationProcess creationProcess) -
shouldProcessSuperMapping
protected boolean shouldProcessSuperMapping() -
linkWithSuperType
Description copied from interface:InFlightEntityMappingType
Link an entity type with its super-type, if one.- Specified by:
linkWithSuperType
in interfaceInFlightEntityMappingType
-
linkWithSubType
Description copied from interface:InFlightEntityMappingType
Called fromInFlightEntityMappingType.linkWithSuperType(org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess)
. A callback from the entity-type to the super-type it resolved.- Specified by:
linkWithSubType
in interfaceInFlightEntityMappingType
-
getNumberOfAttributeMappings
public int getNumberOfAttributeMappings()Description copied from interface:EntityMappingType
The total number of attributes for this entity, including those declared on supertype mappings- Specified by:
getNumberOfAttributeMappings
in interfaceEntityMappingType
- Specified by:
getNumberOfAttributeMappings
in interfaceManagedMappingType
-
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 interfaceEntityPersister
- Specified by:
getAttributeMapping
in interfaceManagedMappingType
-
getNumberOfDeclaredAttributeMappings
public int getNumberOfDeclaredAttributeMappings()Description copied from interface:EntityMappingType
Get the number of attributes defined on this entity mapping - do not access attributes defined on the super- Specified by:
getNumberOfDeclaredAttributeMappings
in interfaceEntityMappingType
-
getDeclaredAttributeMappings
Description copied from interface:EntityMappingType
Get access to the attributes defined on this class - do not access attributes defined on the super- Specified by:
getDeclaredAttributeMappings
in interfaceEntityMappingType
-
visitDeclaredAttributeMappings
Description copied from interface:EntityMappingType
Visit attributes defined on this class - do not visit attributes defined on the super- Specified by:
visitDeclaredAttributeMappings
in interfaceEntityMappingType
-
getSuperMappingType
Description copied from interface:EntityMappingType
The mapping for the entity which is the supertype for this entity mapping.- Specified by:
getSuperMappingType
in interfaceEntityMappingType
- Returns:
- The supertype mapping, or
null
if there is no supertype
-
getSubMappingTypes
Description copied from interface:EntityMappingType
Retrieve mappings for all subtypes- Specified by:
getSubMappingTypes
in interfaceEntityMappingType
-
isTypeOrSuperType
Description copied from interface:EntityMappingType
Whether the passed entity mapping is the same as or is a supertype of this entity mapping- Specified by:
isTypeOrSuperType
in interfaceEntityMappingType
-
generateIdentifierMapping
protected EntityIdentifierMapping generateIdentifierMapping(Supplier<?> templateInstanceCreator, PersistentClass bootEntityDescriptor, MappingModelCreationProcess creationProcess) -
generateNonEncapsulatedCompositeIdentifierMapping
protected EntityIdentifierMapping generateNonEncapsulatedCompositeIdentifierMapping(MappingModelCreationProcess creationProcess, PersistentClass bootEntityDescriptor) -
generateVersionMapping
protected static EntityVersionMapping generateVersionMapping(AbstractEntityPersister entityPersister, Supplier<?> templateInstanceCreator, PersistentClass bootModelRootEntityDescriptor, MappingModelCreationProcess creationProcess) - Parameters:
entityPersister
- The AbstractEntityPersister being constructed - still initializingbootModelRootEntityDescriptor
- The boot-time entity descriptor for the "root entity" in the hierarchycreationProcess
- The SF creation process - access to useful things
-
generateNonIdAttributeMapping
protected AttributeMapping generateNonIdAttributeMapping(NonIdentifierAttribute tupleAttrDefinition, Property bootProperty, int stateArrayPosition, int fetchableIndex, MappingModelCreationProcess creationProcess) -
buildEmbeddedAttributeMapping
protected EmbeddedAttributeMapping buildEmbeddedAttributeMapping(String attrName, int stateArrayPosition, int fetchableIndex, Property bootProperty, DependantValue dependantValue, int dependantColumnIndex, ManagedMappingType declaringType, CompositeType attrType, String tableExpression, String[] rootTableKeyColumnNames, PropertyAccess propertyAccess, CascadeStyle cascadeStyle, MappingModelCreationProcess creationProcess) For Hibernate Reactive -
buildPluralAttributeMapping
protected AttributeMapping buildPluralAttributeMapping(String attrName, int stateArrayPosition, int fetchableIndex, Property bootProperty, ManagedMappingType declaringType, PropertyAccess propertyAccess, CascadeStyle cascadeStyle, FetchMode fetchMode, MappingModelCreationProcess creationProcess) For Hibernate Reactive -
getMappedJavaType
Description copied from interface:MappingType
The descriptor descriptor for the mapped Java type- Specified by:
getMappedJavaType
in interfaceEntityMappingType
- Specified by:
getMappedJavaType
in interfaceMappingType
-
getEntityPersister
Description copied from interface:EntityMappingType
Safety-net.- Specified by:
getEntityPersister
in interfaceEntityMappingType
-
getIdentifierMapping
Description copied from interface:EntityMappingType
Mapping details for the entity's identifier. This is shared across all entity mappings within an inheritance hierarchy.- Specified by:
getIdentifierMapping
in interfaceEntityMappingType
-
getVersionMapping
Description copied from interface:EntityMappingType
Mapping details for the entity's version when using the version strategy. This is shared across all entity mappings within an inheritance hierarchy.- Specified by:
getVersionMapping
in interfaceEntityMappingType
- Returns:
- The version mapping, or null if the entity is (1) defined
with a strategy other than
OptimisticLockStyle.VERSION
or (2) defined without optimistic locking - See Also:
-
getRowIdMapping
Description copied from interface:EntityMappingType
The mapping for the row-id of the entity, if one is defined.- Specified by:
getRowIdMapping
in interfaceEntityMappingType
-
getDiscriminatorMapping
Description copied from interface:EntityMappingType
Mapping details for the entity's discriminator. This is shared across all entity mappings within an inheritance hierarchy.- Specified by:
getDiscriminatorMapping
in interfaceDiscriminable
- Specified by:
getDiscriminatorMapping
in interfaceEntityMappingType
-
getSoftDeleteMapping
Description copied from interface:EntityMappingType
Mapping for soft-delete support, ornull
if soft-delete not defined- Specified by:
getSoftDeleteMapping
in interfaceEntityMappingType
- Specified by:
getSoftDeleteMapping
in interfaceSoftDeletableModelPart
-
getAttributeMappings
Description copied from interface:EntityMappingType
The attributes mapping for this entity, including those declared on supertype mappings- Specified by:
getAttributeMappings
in interfaceEntityMappingType
- Specified by:
getAttributeMappings
in interfaceManagedMappingType
-
findDeclaredAttributeMapping
Description copied from interface:EntityMappingType
Find an attribute-mapping, declared on this entity mapping (not super or subs), by name- Specified by:
findDeclaredAttributeMapping
in interfaceEntityMappingType
-
findAttributeMapping
Description copied from interface:ManagedMappingType
Find an attribute by name.- Specified by:
findAttributeMapping
in interfaceManagedMappingType
- Returns:
- The named attribute, or
null
if no match was found
-
findSubPart
- Specified by:
findSubPart
in interfaceEntityValuedModelPart
- Specified by:
findSubPart
in interfaceModelPartContainer
-
findSubTypesSubPart
- Specified by:
findSubTypesSubPart
in interfaceEntityMappingType
-
visitSubParts
- Specified by:
visitSubParts
in interfaceEntityValuedModelPart
- Specified by:
visitSubParts
in interfaceModelPartContainer
-
visitKeyFetchables
public void visitKeyFetchables(Consumer<? super Fetchable> fetchableConsumer, EntityMappingType treatTargetType) - Specified by:
visitKeyFetchables
in interfaceFetchableContainer
-
visitKeyFetchables
public void visitKeyFetchables(IndexedConsumer<? super Fetchable> fetchableConsumer, EntityMappingType treatTargetType) - Specified by:
visitKeyFetchables
in interfaceFetchableContainer
-
getNumberOfFetchables
public int getNumberOfFetchables()Description copied from interface:FetchableContainer
The number of fetchables in the container- Specified by:
getNumberOfFetchables
in interfaceEntityMappingType
- Specified by:
getNumberOfFetchables
in interfaceFetchableContainer
-
getNumberOfFetchableKeys
public int getNumberOfFetchableKeys()Description copied from interface:FetchableContainer
The number of fetchables in the container- Specified by:
getNumberOfFetchableKeys
in interfaceFetchableContainer
-
getKeyFetchable
- Specified by:
getKeyFetchable
in interfaceFetchableContainer
-
getFetchable
- Specified by:
getFetchable
in interfaceEntityMappingType
- Specified by:
getFetchable
in interfaceFetchableContainer
-
visitFetchables
public void visitFetchables(Consumer<? super Fetchable> fetchableConsumer, EntityMappingType treatTargetType) - Specified by:
visitFetchables
in interfaceFetchableContainer
-
visitFetchables
public void visitFetchables(IndexedConsumer<? super Fetchable> fetchableConsumer, EntityMappingType treatTargetType) - Specified by:
visitFetchables
in interfaceFetchableContainer
-
getStaticFetchableList
-
visitAttributeMappings
Description copied from interface:EntityMappingType
Visit the mappings, but limited to just attributes defined in the targetType or its super-type(s) if any.- Specified by:
visitAttributeMappings
in interfaceEntityMappingType
-
visitSuperTypeAttributeMappings
Description copied from interface:EntityMappingType
Walk this type's attributes as well as its super-type's- Specified by:
visitSuperTypeAttributeMappings
in interfaceEntityMappingType
-
forEachSelectable
Description copied from interface:ModelPart
Visits each selectable mapping with the selectable index offset by the given value. Returns the amount of jdbc types that have been visited.- Specified by:
forEachSelectable
in interfaceModelPart
-
visitSubTypeAttributeMappings
Description copied from interface:EntityMappingType
Walk this type's attributes as well as its sub-type's- Specified by:
visitSubTypeAttributeMappings
in interfaceEntityMappingType
-
getJdbcTypeCount
public int getJdbcTypeCount()Description copied from interface:Bindable
The number of JDBC mappings- Specified by:
getJdbcTypeCount
in interfaceBindable
- Specified by:
getJdbcTypeCount
in interfaceEntityMappingType
- Specified by:
getJdbcTypeCount
in interfaceEntityValuedModelPart
- Specified by:
getJdbcTypeCount
in interfaceJdbcMappingContainer
-
forEachJdbcType
Description copied from interface:JdbcMappingContainer
Visit each JdbcMapping starting from the given offset- Specified by:
forEachJdbcType
in interfaceEntityValuedModelPart
- Specified by:
forEachJdbcType
in interfaceJdbcMappingContainer
-
hasPartitionedSelectionMapping
public boolean hasPartitionedSelectionMapping()- Specified by:
hasPartitionedSelectionMapping
in interfaceManagedMappingType
- Specified by:
hasPartitionedSelectionMapping
in interfaceModelPart
-
isTableCascadeDeleteEnabled
public abstract boolean isTableCascadeDeleteEnabled(int j) -
getSubclassColumnAliasClosure
Deprecated.Hibernate no longer uses aliases to read from result sets -
getSubclassFormulaAliasClosure
Deprecated.Hibernate no longer uses aliases to read from result sets -
getSubclassPropertyColumnAliases
Deprecated.Hibernate no longer uses aliases to read from result setsDescription copied from interface:EntityPersister
Return the column alias names used to persist/query the named property of the class or a subclass (optional operation).- Specified by:
getSubclassPropertyColumnAliases
in interfaceEntityPersister
-
initSubclassPropertyAliasesMap
@Deprecated protected void initSubclassPropertyAliasesMap(PersistentClass model) throws MappingException Deprecated.Hibernate no longer uses aliases to read from result setsMust be called by subclasses, at the end of their constructors- Throws:
MappingException
-
getDiscriminatorAlias
-
getSqlWhereStringTableExpression
-
managesColumns
- Specified by:
managesColumns
in interfaceEntityPersister
-