Class AbstractEntityPersister
- java.lang.Object
-
- org.hibernate.persister.entity.AbstractEntityPersister
-
- All Implemented Interfaces:
LazyPropertyInitializer
,FetchProfileAffectee
,PostInsertIdentityPersister
,Loadable
,ClassMetadata
,Bindable
,Discriminatable
,EntityMappingType
,EntityValuedModelPart
,FilterRestrictable
,InFlightEntityMappingType
,JdbcMappingContainer
,ManagedMappingType
,MappingModelExpressible
,MappingType
,ModelPart
,ModelPartContainer
,Restrictable
,WhereRestrictable
,DeprecatedEntityStuff
,EntityPersister
,Joinable
,Loadable
,Lockable
,EntityMutationTarget
,OuterJoinLoadable
,PropertyMapping
,Queryable
,SQLLoadable
,UniqueKeyLoadable
,AttributeSource
,RootTableGroupProducer
,TableGroupProducer
,MutationTarget<EntityTableMapping>
,FetchableContainer
- Direct Known Subclasses:
JoinedSubclassEntityPersister
,SingleTableEntityPersister
,UnionSubclassEntityPersister
@Internal public abstract class AbstractEntityPersister extends Object implements InFlightEntityMappingType, EntityMutationTarget, LazyPropertyInitializer, PostInsertIdentityPersister, FetchProfileAffectee, DeprecatedEntityStuff
Basic functionality for persisting an entity via JDBC, using either generated or custom SQL.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AbstractEntityPersister.CacheEntryHelper
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
-
Nested classes/interfaces inherited from interface org.hibernate.persister.entity.Queryable
Queryable.Declarer
-
-
Field Summary
Fields Modifier and Type Field Description protected ReflectionOptimizer.AccessOptimizer
accessOptimizer
protected int
batchSize
protected String[]
customSQLDelete
Deprecated.protected String[]
customSQLInsert
Deprecated.protected String[]
customSQLUpdate
Deprecated.protected AttributeMappingsMap
declaredAttributeMappings
protected boolean[]
deleteCallable
Deprecated.protected Expectation[]
deleteExpectations
Deprecated.static String
ENTITY_CLASS
protected String[]
fullDiscriminatorSQLValues
protected boolean[]
insertCallable
Deprecated.protected Expectation[]
insertExpectations
Deprecated.protected BasicEntityPropertyMapping
propertyMapping
Warning: When there are duplicated property names in the subclasses then propertyMapping will only contain one of those properties.protected String
rowIdName
protected AttributeMappingsList
staticFetchableList
protected boolean[]
updateCallable
Deprecated.protected Expectation[]
updateExpectations
Deprecated.static String
VERSION_COLUMN_ALIAS
-
Fields inherited from interface org.hibernate.persister.entity.EntityPersister
ENTITY_ID
-
Fields inherited from interface org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer
UNFETCHED_PROPERTY
-
Fields inherited from interface org.hibernate.persister.entity.Loadable
ROWID_ALIAS
-
-
Constructor Summary
Constructors Constructor Description AbstractEntityPersister(PersistentClass persistentClass, EntityDataAccess cacheAccessStrategy, NaturalIdDataAccess naturalIdRegionAccessStrategy, RuntimeModelCreationContext creationContext)
AbstractEntityPersister(PersistentClass persistentClass, EntityDataAccess cacheAccessStrategy, NaturalIdDataAccess naturalIdRegionAccessStrategy, PersisterCreationContext creationContext)
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addDiscriminatorToInsertGroup(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, 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, 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 theWhere
restrictionsCacheEntry
buildCacheEntry(Object entity, Object[] state, Object version, SharedSessionContractImplementor session)
protected AbstractEntityPersister.CacheEntryHelper
buildCacheEntryHelper(SessionFactoryOptions options)
protected DeleteCoordinator
buildDeleteCoordinator()
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
buildInsertCoordinator()
protected AttributeMapping
buildPluralAttributeMapping(String attrName, int stateArrayPosition, int fetchableIndex, Property bootProperty, ManagedMappingType declaringType, PropertyAccess propertyAccess, CascadeStyle cascadeStyle, FetchMode fetchMode, MappingModelCreationProcess creationProcess)
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[]
buildTableMappings()
Builds the EntityTableMapping descriptors for the tables mapped by this entity.protected UpdateCoordinator
buildUpdateCoordinator()
boolean
canReadFromCache()
boolean
canUseReferenceCacheEntries()
boolean
canWriteToCache()
protected boolean
check(int rows, Object id, int tableNumber, Expectation expectation, PreparedStatement statement, String statementSQL)
boolean
checkVersion(boolean[] includeProperty)
boolean
consumesCollectionAlias()
Very, very, very ugly...boolean
consumesEntityAlias()
Very, very, very ugly...boolean
containsTableReference(String tableExpression)
int
countSubclassProperties()
How many properties are there, for this class and all subclasses?<T> DomainResult<T>
createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState)
Create a DomainResult for a specific reference to this ModelPart.TableReference
createPrimaryTableReference(SqlAliasBase sqlAliasBase, SqlAstCreationState sqlAstCreationState)
Object
createProxy(Object id, SharedSessionContractImplementor session)
Create a new proxy instanceTableGroup
createRootTableGroup(boolean canUseInnerJoins, NavigablePath navigablePath, String explicitSourceAlias, SqlAliasBase explicitSqlAliasBase, Supplier<Consumer<Predicate>> additionalPredicateCollectorAccess, SqlAstCreationState creationState)
Create a root TableGroup as defined by this producerTableReferenceJoin
createTableReferenceJoin(String joinTableExpression, SqlAliasBase sqlAliasBase, TableReference lhs, SqlAstCreationState creationState)
@org.hibernate.Remove int
dehydrate(Object id, Object[] fields, Object rowId, boolean[] includeProperty, boolean[][] includeColumns, int j, PreparedStatement ps, SharedSessionContractImplementor session, int index, boolean isUpdate)
Deprecated, for removal: This API element is subject to removal in a future version.No longer used.void
delete(Object id, Object version, Object object, SharedSessionContractImplementor session)
Delete an objectprotected String
determineTableName(Table table)
int
determineTableNumberForColumn(String columnName)
Object
disassemble(Object value, SharedSessionContractImplementor session)
AttributeMapping
findAttributeMapping(String name)
Find an attribute by name.AttributeMapping
findDeclaredAttributeMapping(String 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.ModelPart
findSubPart(String name, EntityMappingType treatTargetType)
ModelPart
findSubTypesSubPart(String name, EntityMappingType treatTargetType)
Object
forceVersionIncrement(Object id, Object currentVersion, boolean batching, SharedSessionContractImplementor session)
Object
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>
intforEachDisassembledJdbcValue(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>
intforEachJdbcValue(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.@Remove String
generateDeleteString(int j)
Deprecated, for removal: This API element is subject to removal in a future version.No longer used.protected EntityDiscriminatorMapping
generateDiscriminatorMapping(PersistentClass bootEntityDescriptor, MappingModelCreationProcess modelCreationProcess)
String
generateFilterConditionAlias(String rootAlias)
The alias used for any filter conditions (mapped where-fragments or enabled-filters).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)
String
generateSelectVersionString()
Generate the SQL that selects the version number by idprotected @Remove String[]
generateSQLDeleteStrings(Object[] loadedState)
Deprecated, for removal: This API element is subject to removal in a future version.static 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)
AttributeMapping
getAttributeMapping(int position)
Retrieve an attribute mapping by position, relative to all attributesAttributeMappingsList
getAttributeMappings()
The attributes mapping for this entity, including those declared on supertype mappingsBytecodeEnhancementMetadata
getBytecodeEnhancementMetadata()
EntityDataAccess
getCacheAccessStrategy()
Get the cache (optional operation)CacheEntryStructure
getCacheEntryStructure()
Get the cache structureCascadeStyle
getCascadeStyle(int i)
Get the cascade style of this (subclass closure) propertyClassMetadata
getClassMetadata()
Deprecated.Object
getCollectionKey(CollectionPersister persister, Object owner, EntityEntry ownerEntry, SharedSessionContractImplementor session)
Class<?>
getConcreteProxyClass()
Get the proxy interface that instances of this concrete class will be cast to (optional operation).Object
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.AttributeMappingsMap
getDeclaredAttributeMappings()
Get access to the attributes defined on this class - do not access attributes defined on the superDeleteCoordinator
getDeleteCoordinator()
String
getDiscriminatorAlias()
Deprecated.Hibernate no longer uses aliases to read from result setsString
getDiscriminatorAlias(String suffix)
Get the result set aliases used for the identifier columns, given a suffixString
getDiscriminatorColumnName()
String
getDiscriminatorColumnReaders()
String
getDiscriminatorColumnReaderTemplate()
String
getDiscriminatorFormulaTemplate()
EntityDiscriminatorMapping
getDiscriminatorMapping()
Mapping details for the entity's discriminator.abstract BasicType<?>
getDiscriminatorType()
Get the discriminator typeEntityMappingType
getElementTypeDescriptor()
Deprecated, for removal: This API element is subject to removal in a future version.With no replacement.EntityEntryFactory
getEntityEntryFactory()
Get the EntityEntryFactory indicated for the entity mapped by this persister.EntityMetamodel
getEntityMetamodel()
Retrieve the underlying entity metamodel instance.String
getEntityName()
The entity name.static Map<String,String>
getEntityNameByTableNameMap(PersistentClass persistentClass, SqlStringGenerationContext stringGenerationContext)
EntityPersister
getEntityPersister()
Safety-net.EntityType
getEntityType()
SessionFactoryImplementor
getFactory()
Return theSessionFactory
to which this persister belongs.Fetchable
getFetchable(int position)
FetchMode
getFetchMode(int i)
May this (subclass closure) property be fetched using an SQL outerjoin?Generator
getGenerator()
Object
getIdByUniqueKey(Object key, String uniquePropertyName, SharedSessionContractImplementor session)
Object
getIdentifier(Object entity, SharedSessionContractImplementor session)
Get the identifier of an instance from the object's identifier property.String[]
getIdentifierAliases()
String[]
getIdentifierAliases(String suffix)
Get the result set aliases used for the identifier columns, given a suffixString[]
getIdentifierColumnNames()
Get the names of columns used to persist the identifierString[]
getIdentifierColumnReaders()
String[]
getIdentifierColumnReaderTemplates()
int
getIdentifierColumnSpan()
ModelPart
getIdentifierDescriptor()
The ModelPart describing the identifier/key for this targetIdentifierGenerator
getIdentifierGenerator()
Deprecated.EntityIdentifierMapping
getIdentifierMapping()
Mapping details for the entity's identifier.String
getIdentifierPropertyName()
Get the name of the identifier property (or return null) - need not return the name of an actual Java propertyEntityTableMapping
getIdentifierTableMapping()
The descriptor for the table containing the identifier for the targetString
getIdentifierTableName()
The name of the table defining the identifier for this targetType
getIdentifierType()
Get the identifier typeInsertGeneratedIdentifierDelegate
getIdentityInsertDelegate()
The delegate for executing inserts against the root table for targets defined using post-insert id generationString
getIdentitySelectString()
Get the database-specific SQL command to retrieve the last generated IDENTITY value.InsertCoordinator
getInsertCoordinator()
GeneratedValuesProcessor
getInsertGeneratedValuesProcessor()
BytecodeEnhancementMetadata
getInstrumentationMetadata()
JdbcMapping
getJdbcMapping(int index)
int
getJdbcTypeCount()
The number of JDBC mappingsString[]
getKeyColumnNames()
The columns to join onabstract String[]
getKeyColumns(int j)
Fetchable
getKeyFetchable(int position)
protected Map<String,SingleIdArrayLoadPlan>
getLazyLoadPlanByFetchGroup()
protected String[][]
getLazyPropertyColumnAliases()
Deprecated.Hibernate no longer uses aliases to read from result setsClass<?>
getMappedClass()
The persistent class, or nullJavaType<?>
getMappedJavaType()
The descriptor descriptor for the mapped Java typeString
getMappedSuperclass()
Get the name of the entity that is the "super class" for this entityMultiNaturalIdLoader<?>
getMultiNaturalIdLoader()
Access to performing multi-value natural-id database selection.String
getName()
An identifying name; a class name or collection role name.NaturalIdDataAccess
getNaturalIdCacheAccessStrategy()
Get the NaturalId cache (optional operation)int[]
getNaturalIdentifierProperties()
If the entity defines a natural id, that is, ifEntityPersister.hasNaturalIdentifier()
returnstrue
, the indices of the properties which make up the natural id.Object
getNaturalIdentifierSnapshot(Object id, SharedSessionContractImplementor session)
Retrieve the current state of the natural-id properties from the database.NaturalIdLoader<?>
getNaturalIdLoader()
Access to performing natural-id database selection.NaturalIdMapping
getNaturalIdMapping()
The mapping for the natural-id of the entity, if one is definedNavigableRole
getNavigableRole()
The model role of this targetboolean[]
getNonLazyPropertyUpdateability()
int
getNumberOfAttributeMappings()
The total number of attributes for this entity, including those declared on supertype mappingsint
getNumberOfDeclaredAttributeMappings()
Get the number of attributes defined on this entity mapping - do not access attributes defined on the superint
getNumberOfFetchableKeys()
The number of fetchables in the containerint
getNumberOfFetchables()
The number of fetchables in the containerint
getNumberOfKeyFetchables()
The number of key fetchables in the containerString
getPartName()
The local part name, which is generally the unqualified role nameEntityTableMapping
getPhysicalTableMappingForMutation(SelectableMapping selectableMapping)
String[]
getPropertyAliases(String suffix, int i)
Get the result set aliases used for the property columns, given a suffix (properties of this class, only).CascadeStyle[]
getPropertyCascadeStyles()
Get the cascade styles of the properties (optional operation)boolean[]
getPropertyCheckability()
Get the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated)boolean[][]
getPropertyColumnInsertable()
For Hibernate ReactiveString[]
getPropertyColumnNames(int i)
Get the result set column names mapped for this property (properties of this class, only).String[]
getPropertyColumnNames(String propertyName)
Get the column names for the given property pathint
getPropertyColumnSpan(int i)
boolean[][]
getPropertyColumnUpdateable()
For Hibernate ReactiveString[]
getPropertyColumnWriters(int i)
int
getPropertyIndex(String propertyName)
Get the property number of the unique key propertyboolean[]
getPropertyInsertability()
Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT)boolean[]
getPropertyLaziness()
Get the "laziness" of the properties of this classString[]
getPropertyNames()
Get the names of the class properties - doesn't have to be the names of the actual Java properties (used for XML generation only)boolean[]
getPropertyNullability()
Get the nullability of the properties of this classint
getPropertySpan()
String
getPropertyTableName(String propertyName)
Get the table name for the given property pathprotected abstract int[]
getPropertyTableNumbers()
Type
getPropertyType(String propertyName)
Deprecated.by the supertypesType[]
getPropertyTypes()
Get the Hibernate types of the class propertiesboolean[]
getPropertyUpdateability()
Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)boolean[]
getPropertyUpdateability(Object entity)
Which properties appear in the SQL update? (Initialized, updateable ones!)Object
getPropertyValue(Object object, int i)
Object
getPropertyValue(Object object, String propertyName)
Get the value of a particular propertyObject[]
getPropertyValues(Object object)
Extract the property values from the given entity.Object[]
getPropertyValuesToInsert(Object entity, Map<Object,Object> mergeMap, SharedSessionContractImplementor session)
Return the values of the insertable properties of the object (including backrefs)boolean[]
getPropertyVersionability()
Get the "versionability" of the properties of this class (is the property optimistic-locked)Serializable[]
getQuerySpaces()
Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class and its subclasses.EntityRepresentationStrategy
getRepresentationStrategy()
Describes how the entity is represented in the application's domain model.String
getRootEntityName()
Returns an object that identifies the space in which identifiers of this entity hierarchy are unique.String
getRootTableAlias(String drivingAlias)
Get the SQL alias this persister would use for the root table given the passed driving alias.String[]
getRootTableIdentifierColumnNames()
Get the names of columns on the root table used to persist the identifier.String[]
getRootTableKeyColumnNames()
The names of the primary key columns in the root table.String
getRootTableName()
Locks are always applied to the "root table".EntityRowIdMapping
getRowIdMapping()
The mapping for the row-id of the entity, if one is defined.String
getSelectByUniqueKeyString(String propertyName)
Get a SQL select string that performs a select based on a unique key determined by the given property name.String
getSelectByUniqueKeyString(String[] propertyNames)
Get a SQL select string that performs a select based on a unique key determined by the given property names.SingleIdEntityLoader<?>
getSingleIdLoader()
String
getSqlAliasStem()
Get the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generated@Remove String[]
getSQLDeleteStrings()
Deprecated, for removal: This API element is subject to removal in a future version.No longer used.@Remove String[]
getSQLUpdateStrings()
Deprecated, for removal: This API element is subject to removal in a future version.No longer used.SqmMultiTableInsertStrategy
getSqmMultiTableInsertStrategy()
SqmMultiTableMutationStrategy
getSqmMultiTableMutationStrategy()
The strategy to use for SQM mutation statements where the target entity has multiple tables.protected int
getStateArrayInitialPosition(MappingModelCreationProcess creationProcess)
protected AttributeMappingsList
getStaticFetchableList()
abstract Map<Object,String>
getSubclassByDiscriminatorValue()
protected String[]
getSubclassColumnAliasClosure()
Deprecated.Hibernate no longer uses aliases to read from result setsEntityPersister
getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory)
Obtain theEntityPersister
for the concrete class of the given entity instance which participates in a mapped inheritance hierarchy with this persister.protected String[]
getSubclassFormulaAliasClosure()
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[][]
getSubclassPropertyColumnNameClosure()
String[]
getSubclassPropertyColumnNames(int i)
Return the column names used to persist the numbered property of the class or a subclass.String[]
getSubclassPropertyColumnNames(String propertyName)
Return the column names used to persist/query the named property of the class or a subclass (optional operation).String[][]
getSubclassPropertyColumnReaderClosure()
String[][]
getSubclassPropertyColumnReaderTemplateClosure()
Queryable.Declarer
getSubclassPropertyDeclarer(String propertyPath)
Determine whether the given property is declared by our mapped class, our super class, or one of our subclasses...String[][]
getSubclassPropertyFormulaTemplateClosure()
String
getSubclassPropertyName(int i)
Get the name of the numbered property of the class or a subclass.protected String[]
getSubclassPropertyNameClosure()
protected abstract int
getSubclassPropertyTableNumber(int i)
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 (note that SingleTableEntityPersister defines an overloaded form which takes the entity name.Type
getSubclassPropertyType(int i)
Get the type of the numbered property of the class or a subclass.protected Type[]
getSubclassPropertyTypeClosure()
protected abstract String[]
getSubclassTableKeyColumns(int j)
abstract String
getSubclassTableName(int j)
Get the name of the table with the given index from the internal array.protected abstract String[]
getSubclassTableNames()
abstract int
getSubclassTableSpan()
Collection<EntityMappingType>
getSubMappingTypes()
Retrieve mappings for all subtypesEntityMappingType
getSuperMappingType()
The mapping for the entity which is the supertype for this entity mapping.String
getTableAliasForColumn(String columnName, String rootAlias)
Given a column name and the root table alias in use for the entity hierarchy, determine the proper table alias for the table in that hierarchy that contains said column.protected boolean[]
getTableHasColumns()
static int
getTableId(String tableName, String[] tables)
EntityTableMapping
getTableMapping(int i)
protected EntityTableMapping[]
getTableMappings()
int
getTableMappingsCount()
Deprecated, for removal: This API element is subject to removal in a future version.this method is no longer usedabstract String
getTableName(int j)
Deprecated.Only ever used from places where we really want to useSelectStatement
(select generator)InsertSelectStatement
UpdateStatement
DeleteStatement
String[]
getTableNames()
abstract int
getTableSpan()
@org.hibernate.Remove boolean[]
getTableUpdateNeeded(int[] dirtyProperties, boolean hasDirtyCollection)
Deprecated, for removal: This API element is subject to removal in a future version.No longer used.EntityMappingType
getTargetPart()
The ModelPart describing the mutation targetType
getType()
Get the typeDiscriminatorMetadata
getTypeDiscriminatorMetadata()
Retrieve the information needed to properly deal with this entity's discriminator in a query.protected SingleUniqueKeyEntityLoader<?>
getUniqueKeyLoader(String attributeName)
UpdateCoordinator
getUpdateCoordinator()
GeneratedValuesProcessor
getUpdateGeneratedValuesProcessor()
Object
getVersion(Object object)
Get the version number (or timestamp) from the object's version property.String
getVersionColumnName()
For versioned entities, get the name of the column (again, expected on the root table) used to store the version values.String
getVersionedTableName()
BeforeExecutionGenerator
getVersionGenerator()
EntityVersionMapping
getVersionMapping()
Mapping details for the entity's version when using the version strategy.int
getVersionProperty()
IfEntityPersister.isVersioned()
, then what is the index of the property holding the locking value.String
getVersionSelectString()
BasicType<?>
getVersionType()
IfEntityPersister.isVersioned()
, then what is the type of the property holding the locking value.protected boolean
hasAnySkippableTables(boolean[] optionalTables, boolean[] inverseTables)
boolean
hasCache()
Does this class have a cache.boolean
hasCascadeDelete()
Determine whether this entity has any delete cascading.boolean
hasCascades()
Determine whether this entity has any (non-none) cascading.boolean
hasCollectionNotReferencingPK()
Determine whether this entity contains references to persistent collections not referencing the primary key.boolean
hasCollections()
Determine whether this entity contains references to persistent collections.abstract boolean
hasDuplicateTables()
boolean
hasFormulaProperties()
boolean
hasIdentifierProperty()
Determine whether the entity has a particular property holding the identifier value.boolean
hasInsertGeneratedProperties()
Does this entity define any properties as being database generated on insert?boolean
hasLazyDirtyFields(int[] dirtyFields)
boolean
hasLazyProperties()
Determine whether this entity defines any lazy properties (when bytecode instrumentation is enabled).protected boolean
hasMultipleTables()
boolean
hasMutableProperties()
Determine whether any properties of this entity are considered mutable.boolean
hasNaturalIdCache()
Does this class have a natural id cacheboolean
hasNaturalIdentifier()
Determine whether this entity defines a natural identifier.boolean
hasOwnedCollections()
Determine whether this entity has any owned collections.boolean
hasPartitionedSelectionMapping()
boolean
hasProxy()
Determine whether this entity supports dynamic proxies.boolean
hasRowId()
Does the result set contain rowids?boolean
hasSkippableTables()
Whether this target defines any potentially skippable tables.boolean
hasSubclasses()
Whether this entity mapping has any subtype mappingsboolean
hasSubselectLoadableCollections()
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
hasUpdateGeneratedProperties()
Does this entity define any properties as being database generated on update?boolean
implementsLifecycle()
Does the class implement theLifecycle
interface?Object
initializeEnhancedEntityUsedAsProxy(Object entity, String nameOfAttributeBeingAccessed, SharedSessionContractImplementor session)
Called fromEnhancementAsProxyLazinessInterceptor
to trigger load of the entity's non-lazy state as well as the named attribute we are accessing if it is still uninitialized after fetching non-lazy state.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 ReactiveObject
initializeLazyProperty(String fieldName, Object entity, SharedSessionContractImplementor session)
Initialize the property, and return its new value.protected void
initPropertyPaths(Metadata mapping)
protected void
initSubclassPropertyAliasesMap(PersistentClass model)
Deprecated.Hibernate no longer uses aliases to read from result setsObject
insert(Object[] fields, Object object, SharedSessionContractImplementor session)
Persist an instance, using a natively generated identifier (optional operation)void
insert(Object id, Object[] fields, Object object, SharedSessionContractImplementor session)
Persist an instanceObject
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
isAbstract()
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)
Whether any of the "influencers" affect this loadable.boolean
isAffectedByEntityGraph(LoadQueryInfluencers loadQueryInfluencers)
Whether the effective entity-graph applies to this loadable@org.hibernate.Remove boolean
isAllNull(Object[] array, int tableNumber)
Deprecated, for removal: This API element is subject to removal in a future version.protected boolean
isAllOrDirtyOptLocking()
Deprecated, for removal: This API element is subject to removal in a future version.this method is no longer used@org.hibernate.Remove boolean
isBatchable()
Deprecated, for removal: This API element is subject to removal in a future version.No longer used.boolean
isBatchLoadable()
Is batch loading enabled?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.protected boolean
isClassOrSuperclassJoin(int j)
protected abstract boolean
isClassOrSuperclassTable(int j)
boolean
isCollection()
Is this instance actually a CollectionPersister?boolean
isDefinedOnSubclass(int i)
Is this property defined on a subclass of the mapped class.boolean
isDeleteCallable(int j)
Deprecated, for removal: This API element is subject to removal in a future version.With no replacementprotected boolean
isDiscriminatorFormula()
boolean
isExplicitPolymorphism()
Is this class explicit polymorphism only?boolean
isIdentifierAssignedByInsert()
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
isInherited()
Determine whether the entity is inherited one or more other entities.boolean
isInsertCallable(int j)
Deprecated, for removal: This API element is subject to removal in a future version.With no replacementboolean
isInstance(Object object)
Is the given object an instance of this entity?boolean
isInstrumented()
Has the class actually been bytecode instrumented?protected @org.hibernate.Remove boolean
isInverseSubclassTable(int j)
Deprecated, for removal: This API element is subject to removal in a future version.No longer usedboolean
isInverseTable(int j)
boolean
isLazyPropertiesCacheable()
Should lazy properties of this entity be cached?boolean
isMultiTable()
Deprecated.boolean
isMutable()
Determine whether instances of this entity are considered mutable.protected boolean
isNullableSubclassTable(int j)
boolean
isNullableTable(int j)
protected boolean
isPhysicalDiscriminator()
boolean
isPolymorphic()
abstract boolean
isPropertyOfTable(int property, int j)
boolean
isPropertySelectable(int propertyNumber)
boolean
isSelectable(FetchParent fetchParent, Fetchable fetchable)
Deprecated.useFetchable.isSelectable()
instead.boolean
isSelectBeforeUpdateRequired()
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.boolean
isSubclassPropertyNullable(int i)
Is the numbered property of the class of subclass nullable?protected boolean
isSubclassTableIndicatedByTreatAsDeclarations(int subclassTableNumber, Set<String> treatAsDeclarations)
protected boolean
isSubclassTableSequentialSelect(int j)
Deprecated, for removal: This API element is subject to removal in a future version.With no replacementabstract @org.hibernate.Remove boolean
isTableCascadeDeleteEnabled(int j)
Deprecated, for removal: This API element is subject to removal in a future version.No longer usedBoolean
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
isUpdateCallable(int j)
Deprecated, for removal: This API element is subject to removal in a future version.With no replacementboolean
isVersioned()
Determine whether optimistic locking by column is enabled for this entity.boolean
isVersionGeneratedBeforeExecution()
boolean
isVersionGeneratedOnExecution()
boolean
isVersionPropertyGenerated()
Does this entity contain a version property that is defined to be database generated?boolean
isVersionPropertyInsertable()
Is the version property included in insert statements?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.Object
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
parameterObject
load(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session)
Load an instance using either theforUpdateLoader
or the outer joiningloader
, depending upon the value of thelock
parameterObject
load(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session, Boolean readOnly)
Object
loadByUniqueKey(String propertyName, Object uniqueKey, Boolean readOnly, SharedSessionContractImplementor session)
Object
loadByUniqueKey(String propertyName, Object uniqueKey, SharedSessionContractImplementor session)
Load an instance of the persistent class, by a unique key other than the primary key.Object
loadEntityIdByNaturalId(Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session)
Load the id for the entity based on the natural id.void
lock(Object id, Object version, Object object, LockMode lockMode, EventSource session)
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
logStaticSQL()
List<?>
multiLoad(Object[] ids, EventSource session, MultiIdLoadOptions loadOptions)
Performs a load of multiple entities (of this type) by identifier simultaneously.protected abstract boolean
needsDiscriminator()
OptimisticLockStyle
optimisticLockStyle()
The type of optimistic locking, if any, defined for this entity mappingString
physicalTableNameForMutation(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.void
postInstantiate()
Finish the initialization of this object.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, SharedSessionContractImplementor session)
Perform a select to retrieve the values of any generated properties back from the database, injecting these generated values into the given entity as well as writing this state to thePersistenceContext
.void
processUpdateGeneratedProperties(Object id, Object entity, Object[] state, SharedSessionContractImplementor session)
Perform a select to retrieve the values of any generated properties back from the database, injecting these generated values into the given entity as well as writing this state to thePersistenceContext
.void
registerAffectingFetchProfile(String fetchProfileName)
Register the name of a fetch profile determined to have an affect on the underlying loadable in regards to the fact that the underlying load SQL needs to be adjust when the given fetch profile is enabled.void
registerAffectingFetchProfile(String fetchProfileName, Fetch.Style fetchStyle)
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 metamodelint[]
resolveDirtyAttributeIndexes(Object[] currentState, Object[] previousState, String[] attributeNames, SessionImplementor session)
LikeEntityPersister.resolveAttributeIndexes(String[])
but also always returns mutable attributesprotected DiscriminatorType
resolveDiscriminatorType()
String
selectFragment(String alias, String suffix)
Generate a list of collection index, key and element columnsvoid
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
setPropertyValue(Object object, String propertyName, Object value)
Set the value of a particular (named) propertyvoid
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
shouldProcessSuperMapping()
protected String
substituteBrackets(String sql)
String[]
toColumns(String propertyName)
Given a property path, return the corresponding column name(s).String[]
toColumns(String name, int i)
Given the number of a property of a subclass, and a table alias, return the aliased column names.String
toString()
Type
toType(String propertyName)
Given a component path expression, get the type of the propertyIterable<UniqueKeyEntry>
uniqueKeyEntries()
void
update(Object id, Object[] values, int[] dirtyAttributeIndexes, boolean hasDirtyCollection, Object[] oldValues, Object oldVersion, Object object, Object rowId, SharedSessionContractImplementor session)
Update an objectprotected void
verifyHasNaturalId()
void
visitAttributeMappings(Consumer<? super AttributeMapping> action, EntityMappingType targetType)
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's-
Methods 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, getJdbcMappings
-
Methods inherited from interface org.hibernate.metadata.ClassMetadata
getIdentifier, getIdentifier, getPropertyValuesToInsert, instantiate, setIdentifier
-
Methods inherited from interface org.hibernate.metamodel.mapping.EntityMappingType
asEntityMappingType, extractConcreteTypeStateValues, findContainingEntityMapping, findSubPart, getContributor, getIdentifierTableDetails, getJavaType, getMappedTableDetails, getPartMappingType, getRootEntityDescriptor, getRootPathName, getSubclassEntityNames, getSubclassId, isTypeOrSuperType, pruneForSubclasses, pruneForSubclasses, visitConstraintOrderedTables
-
Methods inherited from interface org.hibernate.persister.entity.EntityPersister
addToCacheKey, breakDownJdbcValues, canExtractIdOutOfEntity, getEntityMappingType, getFilterAliasGenerator, getFilterAliasGenerator, getPropertySpaces, getSynchronizationSpaces, getSynchronizedQuerySpaces, getValue, getValues, getVersionJavaType, load, setValue, setValues, visitQuerySpaces
-
Methods inherited from interface org.hibernate.metamodel.mapping.EntityValuedModelPart
forEachSubPart
-
Methods inherited from interface org.hibernate.sql.results.graph.FetchableContainer
getSelectableIndex, visitFetchables, visitKeyFetchables
-
Methods inherited from interface org.hibernate.metamodel.mapping.JdbcMappingContainer
getSingleJdbcMapping
-
Methods inherited from interface org.hibernate.persister.entity.Joinable
getTableName
-
Methods inherited from interface org.hibernate.loader.ast.spi.Loadable
isAffectedByInfluencers, isNotAffectedByInfluencers
-
Methods inherited from interface org.hibernate.persister.entity.Loadable
getDiscriminatorValue, getSubclassForDiscriminatorValue
-
Methods inherited from interface org.hibernate.metamodel.mapping.ManagedMappingType
anyRequiresAggregateColumnWriter
-
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.persister.entity.OuterJoinLoadable
fromTableFragment, getAttributeMutationTableName, getSubclassPropertyTableName
-
Methods inherited from interface org.hibernate.persister.entity.Queryable
getConstraintOrderedTableNameClosure, getContraintOrderedTableKeyColumnClosure, getDiscriminatorSQLValue
-
-
-
-
Field Detail
-
ENTITY_CLASS
public static final String ENTITY_CLASS
- See Also:
- Constant Field Values
-
VERSION_COLUMN_ALIAS
public static final String VERSION_COLUMN_ALIAS
- See Also:
- Constant Field Values
-
batchSize
protected final int batchSize
-
rowIdName
protected final String rowIdName
-
declaredAttributeMappings
protected AttributeMappingsMap declaredAttributeMappings
-
staticFetchableList
protected AttributeMappingsList staticFetchableList
-
accessOptimizer
protected ReflectionOptimizer.AccessOptimizer accessOptimizer
-
fullDiscriminatorSQLValues
protected final String[] fullDiscriminatorSQLValues
-
propertyMapping
protected final BasicEntityPropertyMapping propertyMapping
Warning: When there are duplicated property names in the subclasses then propertyMapping will only contain one of those properties. To ensure correct results, propertyMapping should only be used for the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).
-
insertExpectations
@Deprecated protected Expectation[] insertExpectations
Deprecated.
-
updateExpectations
@Deprecated protected Expectation[] updateExpectations
Deprecated.
-
deleteExpectations
@Deprecated protected Expectation[] deleteExpectations
Deprecated.
-
insertCallable
@Deprecated protected boolean[] insertCallable
Deprecated.
-
updateCallable
@Deprecated protected boolean[] updateCallable
Deprecated.
-
deleteCallable
@Deprecated protected boolean[] deleteCallable
Deprecated.
-
customSQLInsert
@Deprecated protected String[] customSQLInsert
Deprecated.
-
customSQLUpdate
@Deprecated protected String[] customSQLUpdate
Deprecated.
-
customSQLDelete
@Deprecated protected String[] customSQLDelete
Deprecated.
-
-
Constructor Detail
-
AbstractEntityPersister
@Deprecated(since="6.0") public AbstractEntityPersister(PersistentClass persistentClass, EntityDataAccess cacheAccessStrategy, NaturalIdDataAccess naturalIdRegionAccessStrategy, PersisterCreationContext creationContext) throws HibernateException
Deprecated.- Throws:
HibernateException
-
AbstractEntityPersister
public AbstractEntityPersister(PersistentClass persistentClass, EntityDataAccess cacheAccessStrategy, NaturalIdDataAccess naturalIdRegionAccessStrategy, RuntimeModelCreationContext creationContext) throws HibernateException
- Throws:
HibernateException
-
-
Method Detail
-
getEntityNameByTableNameMap
public static Map<String,String> getEntityNameByTableNameMap(PersistentClass persistentClass, SqlStringGenerationContext stringGenerationContext)
-
getSubclassTableName
public abstract String getSubclassTableName(int j)
Description copied from interface:Queryable
Get the name of the table with the given index from the internal array.- Specified by:
getSubclassTableName
in interfaceQueryable
- Parameters:
j
- The index into the internal array.
-
getSubclassTableNames
protected abstract String[] getSubclassTableNames()
-
getSubclassTableKeyColumns
protected abstract String[] getSubclassTableKeyColumns(int j)
-
isClassOrSuperclassTable
protected abstract boolean isClassOrSuperclassTable(int j)
-
isClassOrSuperclassJoin
protected boolean isClassOrSuperclassJoin(int j)
-
getSubclassTableSpan
public abstract int getSubclassTableSpan()
-
getTableSpan
public abstract int getTableSpan()
-
hasDuplicateTables
public abstract boolean hasDuplicateTables()
-
getTableName
@Deprecated(since="6.2") public abstract String getTableName(int j)
Deprecated.Only ever used from places where we really want to useSelectStatement
(select generator)InsertSelectStatement
UpdateStatement
DeleteStatement
-
getKeyColumns
public abstract String[] getKeyColumns(int j)
-
isPropertyOfTable
public abstract boolean isPropertyOfTable(int property, int j)
-
getPropertyTableNumbers
protected abstract int[] getPropertyTableNumbers()
-
getSubclassPropertyTableNumber
protected abstract int getSubclassPropertyTableNumber(int i)
-
getDiscriminatorColumnName
public String getDiscriminatorColumnName()
- Specified by:
getDiscriminatorColumnName
in interfaceLoadable
- Returns:
- the column name for the discriminator as specified in the mapping.
-
getDiscriminatorColumnReaders
public String getDiscriminatorColumnReaders()
-
getDiscriminatorColumnReaderTemplate
public String getDiscriminatorColumnReaderTemplate()
-
getDiscriminatorFormulaTemplate
public String getDiscriminatorFormulaTemplate()
-
isInverseTable
public boolean isInverseTable(int j)
-
isNullableTable
public boolean isNullableTable(int j)
-
isNullableSubclassTable
protected boolean isNullableSubclassTable(int j)
-
isSubclassEntityName
public boolean isSubclassEntityName(String entityName)
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.
-
isSharedColumn
public boolean isSharedColumn(String columnExpression)
-
getTableHasColumns
protected boolean[] getTableHasColumns()
-
getRootTableKeyColumnNames
public String[] getRootTableKeyColumnNames()
Description copied from interface:PostInsertIdentityPersister
The names of the primary key columns in the root table.- Specified by:
getRootTableKeyColumnNames
in interfacePostInsertIdentityPersister
- Returns:
- The primary key column names.
-
getInsertCoordinator
@Internal public InsertCoordinator getInsertCoordinator()
-
getUpdateCoordinator
@Internal public UpdateCoordinator getUpdateCoordinator()
-
getDeleteCoordinator
@Internal public DeleteCoordinator getDeleteCoordinator()
-
getVersionSelectString
public String getVersionSelectString()
-
getInsertGeneratedValuesProcessor
@Internal public GeneratedValuesProcessor getInsertGeneratedValuesProcessor()
-
getUpdateGeneratedValuesProcessor
@Internal public GeneratedValuesProcessor getUpdateGeneratedValuesProcessor()
-
hasRowId
public boolean hasRowId()
Description copied from interface:Loadable
Does the result set contain rowids?
-
getPropertyColumnUpdateable
public boolean[][] getPropertyColumnUpdateable()
For Hibernate Reactive
-
getPropertyColumnInsertable
public boolean[][] getPropertyColumnInsertable()
For Hibernate Reactive
-
getTableNames
public String[] getTableNames()
-
buildCacheEntryHelper
protected AbstractEntityPersister.CacheEntryHelper buildCacheEntryHelper(SessionFactoryOptions options)
-
canUseReferenceCacheEntries
public boolean canUseReferenceCacheEntries()
- Specified by:
canUseReferenceCacheEntries
in interfaceEntityPersister
-
uniqueKeyEntries
public Iterable<UniqueKeyEntry> uniqueKeyEntries()
- Specified by:
uniqueKeyEntries
in interfaceEntityPersister
- Returns:
- Metadata for each unique key defined
-
getLazyLoadPlanByFetchGroup
protected Map<String,SingleIdArrayLoadPlan> getLazyLoadPlanByFetchGroup()
-
getSqlAliasStem
public String 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:
SqlAliasBaseManager.createSqlAliasBase(java.lang.String)
-
containsTableReference
public boolean containsTableReference(String tableExpression)
- Specified by:
containsTableReference
in interfaceTableGroupProducer
-
getPartName
public String 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
-
createDomainResult
public <T> DomainResult<T> createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState)
Description copied from interface:ModelPart
Create a DomainResult for a specific reference to this ModelPart.- Specified by:
createDomainResult
in interfaceEntityValuedModelPart
- Specified by:
createDomainResult
in interfaceModelPart
-
applySqlSelections
public void applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState)
Description copied from interface:ModelPart
Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.- Specified by:
applySqlSelections
in interfaceEntityValuedModelPart
- Specified by:
applySqlSelections
in interfaceModelPart
-
applySqlSelections
public void applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState, BiConsumer<SqlSelection,JdbcMapping> selectionConsumer)
Description copied from interface:ModelPart
Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.- Specified by:
applySqlSelections
in interfaceEntityValuedModelPart
- Specified by:
applySqlSelections
in interfaceModelPart
-
getNaturalIdMapping
public NaturalIdMapping 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
public Object initializeLazyProperty(String fieldName, Object entity, SharedSessionContractImplementor session)
Description copied from interface:LazyPropertyInitializer
Initialize the property, and return its new value.- Specified by:
initializeLazyProperty
in interfaceLazyPropertyInitializer
- Parameters:
fieldName
- The name of the field being initializedentity
- The entity on which the initialization is occurringsession
- The session from which the initialization originated.- Returns:
- ?
-
getCollectionKey
public Object getCollectionKey(CollectionPersister persister, Object owner, EntityEntry ownerEntry, SharedSessionContractImplementor session)
-
initializeLazyPropertiesFromDatastore
protected Object initializeLazyPropertiesFromDatastore(Object entity, Object id, EntityEntry entry, String fieldName, SharedSessionContractImplementor session)
-
initializeLazyPropertiesFromCache
protected Object initializeLazyPropertiesFromCache(String fieldName, Object entity, SharedSessionContractImplementor session, EntityEntry entry, CacheEntry cacheEntry)
-
initializeLazyProperty
protected boolean initializeLazyProperty(String fieldName, Object entity, EntityEntry entry, int index, Object propValue)
Called by Hibernate Reactive
-
getNavigableRole
public NavigableRole getNavigableRole()
Description copied from interface:MutationTarget
The model role of this target- Specified by:
getNavigableRole
in interfaceModelPart
- Specified by:
getNavigableRole
in interfaceMutationTarget<EntityTableMapping>
- See Also:
ModelPart.getPartName()
-
getQuerySpaces
public Serializable[] 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.
-
isBatchLoadable
public boolean isBatchLoadable()
Description copied from interface:EntityPersister
Is batch loading enabled?- Specified by:
isBatchLoadable
in interfaceEntityPersister
-
getIdentifierColumnNames
public String[] getIdentifierColumnNames()
Description copied from interface:Loadable
Get the names of columns used to persist the identifier- Specified by:
getIdentifierColumnNames
in interfaceLoadable
- Specified by:
getIdentifierColumnNames
in interfacePostInsertIdentityPersister
- Specified by:
getIdentifierColumnNames
in interfaceQueryable
-
getIdentifierColumnReaders
public String[] getIdentifierColumnReaders()
-
getIdentifierColumnReaderTemplates
public String[] getIdentifierColumnReaderTemplates()
-
getIdentifierColumnSpan
public int getIdentifierColumnSpan()
-
getIdentifierAliases
public String[] getIdentifierAliases()
-
getVersionColumnName
public String getVersionColumnName()
Description copied from interface:Lockable
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 interfaceLockable
- Returns:
- The version column name.
-
getVersionedTableName
public String 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
public String selectFragment(String alias, String suffix)
Description copied from interface:OuterJoinLoadable
Generate a list of collection index, key and element columns- Specified by:
selectFragment
in interfaceOuterJoinLoadable
- Specified by:
selectFragment
in interfaceSQLLoadable
-
isSelectable
@Deprecated public boolean isSelectable(FetchParent fetchParent, Fetchable fetchable)
Deprecated.useFetchable.isSelectable()
instead.
-
getIdentifierAliases
public String[] getIdentifierAliases(String suffix)
Description copied from interface:Loadable
Get the result set aliases used for the identifier columns, given a suffix- Specified by:
getIdentifierAliases
in interfaceLoadable
-
getPropertyAliases
public String[] getPropertyAliases(String suffix, int i)
Description copied from interface:Loadable
Get the result set aliases used for the property columns, given a suffix (properties of this class, only).- Specified by:
getPropertyAliases
in interfaceLoadable
-
getDiscriminatorAlias
public String getDiscriminatorAlias(String suffix)
Description copied from interface:Loadable
Get the result set aliases used for the identifier columns, given a suffix- Specified by:
getDiscriminatorAlias
in interfaceLoadable
-
getDatabaseSnapshot
public Object[] getDatabaseSnapshot(Object id, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:EntityPersister
Get the current database state of the object, in a "hydrated" form, without resolving identifiers.- Specified by:
getDatabaseSnapshot
in interfaceEntityPersister
- Returns:
- null if there is no row in the database
- Throws:
HibernateException
-
getIdByUniqueKey
public Object getIdByUniqueKey(Object key, String uniquePropertyName, SharedSessionContractImplementor session)
- Specified by:
getIdByUniqueKey
in interfaceEntityPersister
-
generateSelectVersionString
public String generateSelectVersionString()
Generate the SQL that selects the version number by id
-
forceVersionIncrement
public Object forceVersionIncrement(Object id, Object currentVersion, SharedSessionContractImplementor session)
- Specified by:
forceVersionIncrement
in interfaceEntityPersister
-
forceVersionIncrement
public Object forceVersionIncrement(Object id, Object currentVersion, boolean batching, SharedSessionContractImplementor session) throws HibernateException
- Specified by:
forceVersionIncrement
in interfaceEntityPersister
- Throws:
HibernateException
-
getCurrentVersion
public Object getCurrentVersion(Object id, SharedSessionContractImplementor session) throws HibernateException
Retrieve the version number- Specified by:
getCurrentVersion
in interfaceEntityPersister
- Throws:
HibernateException
-
getJdbcMapping
public JdbcMapping getJdbcMapping(int index)
- Specified by:
getJdbcMapping
in interfaceJdbcMappingContainer
-
generateLocker
protected LockingStrategy generateLocker(LockMode lockMode)
-
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
public String getRootTableName()
Description copied from interface:Lockable
Locks are always applied to the "root table".- Specified by:
getRootTableName
in interfaceLockable
- Returns:
- The root table name
-
getRootTableAlias
public String getRootTableAlias(String drivingAlias)
Description copied from interface:Lockable
Get the SQL alias this persister would use for the root table given the passed driving alias.- Specified by:
getRootTableAlias
in interfaceLockable
- Parameters:
drivingAlias
- The driving alias; or the alias for the table mapped by this persister in the hierarchy.- Returns:
- The root table alias.
-
getRootTableIdentifierColumnNames
public String[] getRootTableIdentifierColumnNames()
Description copied from interface:Lockable
Get the names of columns on the root table used to persist the identifier.- Specified by:
getRootTableIdentifierColumnNames
in interfaceLockable
- Returns:
- The root table identifier column names.
-
toColumns
public String[] toColumns(String propertyName) throws QueryException
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 interfacePropertyMapping
- Throws:
QueryException
-
toType
public Type toType(String propertyName) throws QueryException
Given a component path expression, get the type of the property 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:
toType
in interfacePropertyMapping
- Throws:
QueryException
-
getPropertyColumnNames
public String[] getPropertyColumnNames(String propertyName)
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 interfaceOuterJoinLoadable
-
getSubclassPropertyTableNumber
public 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 (note that SingleTableEntityPersister defines an overloaded form which takes the entity name.- Specified by:
getSubclassPropertyTableNumber
in interfaceQueryable
- Parameters:
propertyPath
- The name of the property.- Returns:
- The number of the table to which the property is mapped.
-
getSubclassPropertyDeclarer
public Queryable.Declarer getSubclassPropertyDeclarer(String propertyPath)
Description copied from interface:Queryable
Determine whether the given property is declared by our mapped class, our super class, or one of our subclasses...Note: the method is called 'subclass property...' simply for consistency sake (e.g.
Queryable.getSubclassPropertyTableNumber(java.lang.String)
- Specified by:
getSubclassPropertyDeclarer
in interfaceQueryable
- Parameters:
propertyPath
- The property name.- Returns:
- The property declarer
-
getPropertyTableName
public String getPropertyTableName(String propertyName)
Description copied from interface:OuterJoinLoadable
Get the table name for the given property path- Specified by:
getPropertyTableName
in interfaceOuterJoinLoadable
-
resolveDiscriminatorType
protected DiscriminatorType resolveDiscriminatorType()
-
getTypeDiscriminatorMetadata
public DiscriminatorMetadata getTypeDiscriminatorMetadata()
Description copied from interface:Queryable
Retrieve the information needed to properly deal with this entity's discriminator in a query.- Specified by:
getTypeDiscriminatorMetadata
in interfaceQueryable
- Returns:
- The entity discriminator metadata
-
toColumns
public String[] toColumns(String name, int i)
Description copied from interface:OuterJoinLoadable
Given the number of a property of a subclass, and a table alias, return the aliased column names.- Specified by:
toColumns
in interfaceOuterJoinLoadable
-
getPropertyColumnNames
public String[] getPropertyColumnNames(int i)
Description copied from interface:Loadable
Get the result set column names mapped for this property (properties of this class, only).- Specified by:
getPropertyColumnNames
in interfaceLoadable
-
getPropertyColumnWriters
public String[] getPropertyColumnWriters(int i)
-
getPropertyColumnSpan
public int getPropertyColumnSpan(int i)
-
hasFormulaProperties
public boolean hasFormulaProperties()
-
getFetchMode
public FetchMode getFetchMode(int i)
Description copied from interface:OuterJoinLoadable
May this (subclass closure) property be fetched using an SQL outerjoin?- Specified by:
getFetchMode
in interfaceOuterJoinLoadable
-
getCascadeStyle
public CascadeStyle getCascadeStyle(int i)
Description copied from interface:OuterJoinLoadable
Get the cascade style of this (subclass closure) property- Specified by:
getCascadeStyle
in interfaceOuterJoinLoadable
-
getSubclassPropertyType
public Type getSubclassPropertyType(int i)
Description copied from interface:OuterJoinLoadable
Get the type of the numbered property of the class or a subclass.- Specified by:
getSubclassPropertyType
in interfaceOuterJoinLoadable
-
getSubclassPropertyName
public String getSubclassPropertyName(int i)
Description copied from interface:OuterJoinLoadable
Get the name of the numbered property of the class or a subclass.- Specified by:
getSubclassPropertyName
in interfaceOuterJoinLoadable
-
countSubclassProperties
public int countSubclassProperties()
Description copied from interface:OuterJoinLoadable
How many properties are there, for this class and all subclasses?- Specified by:
countSubclassProperties
in interfaceOuterJoinLoadable
-
getSubclassPropertyColumnNames
public String[] getSubclassPropertyColumnNames(int i)
Description copied from interface:OuterJoinLoadable
Return the column names used to persist the numbered property of the class or a subclass.- Specified by:
getSubclassPropertyColumnNames
in interfaceOuterJoinLoadable
-
isDefinedOnSubclass
public boolean isDefinedOnSubclass(int i)
Description copied from interface:OuterJoinLoadable
Is this property defined on a subclass of the mapped class.- Specified by:
isDefinedOnSubclass
in interfaceOuterJoinLoadable
-
getSubclassPropertyFormulaTemplateClosure
public String[][] getSubclassPropertyFormulaTemplateClosure()
- Specified by:
getSubclassPropertyFormulaTemplateClosure
in interfaceQueryable
-
getSubclassPropertyTypeClosure
protected Type[] getSubclassPropertyTypeClosure()
-
getSubclassPropertyColumnNameClosure
protected String[][] getSubclassPropertyColumnNameClosure()
-
getSubclassPropertyColumnReaderClosure
public String[][] getSubclassPropertyColumnReaderClosure()
-
getSubclassPropertyColumnReaderTemplateClosure
public String[][] getSubclassPropertyColumnReaderTemplateClosure()
-
getSubclassPropertyNameClosure
protected String[] getSubclassPropertyNameClosure()
-
resolveAttributeIndexes
public int[] resolveAttributeIndexes(String[] attributeNames)
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
-
getSubclassPropertyColumnNames
public String[] getSubclassPropertyColumnNames(String propertyName)
Description copied from interface:SQLLoadable
Return the column names used to persist/query the named property of the class or a subclass (optional operation).- Specified by:
getSubclassPropertyColumnNames
in interfaceSQLLoadable
-
loadByUniqueKey
public Object loadByUniqueKey(String propertyName, Object uniqueKey, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:EntityMappingType
Load an instance of the persistent class, by a unique key other than the primary key.- Specified by:
loadByUniqueKey
in interfaceEntityMappingType
- Specified by:
loadByUniqueKey
in interfaceEntityPersister
- Specified by:
loadByUniqueKey
in interfaceUniqueKeyLoadable
- Throws:
HibernateException
-
loadByUniqueKey
public Object loadByUniqueKey(String propertyName, Object uniqueKey, Boolean readOnly, SharedSessionContractImplementor session) throws HibernateException
- Throws:
HibernateException
-
getUniqueKeyLoader
protected SingleUniqueKeyEntityLoader<?> getUniqueKeyLoader(String attributeName)
-
getPropertyIndex
public int getPropertyIndex(String propertyName)
Description copied from interface:UniqueKeyLoadable
Get the property number of the unique key property- Specified by:
getPropertyIndex
in interfaceAttributeSource
- Specified by:
getPropertyIndex
in interfaceUniqueKeyLoadable
-
initPropertyPaths
protected void initPropertyPaths(Metadata mapping) throws MappingException
- Throws:
MappingException
-
check
protected boolean check(int rows, Object id, int tableNumber, Expectation expectation, PreparedStatement statement, String statementSQL) throws HibernateException
- Throws:
HibernateException
-
checkVersion
public final boolean checkVersion(boolean[] includeProperty)
-
getIdentitySelectString
public String getIdentitySelectString()
Description copied from interface:PostInsertIdentityPersister
Get the database-specific SQL command to retrieve the last generated IDENTITY value.- Specified by:
getIdentitySelectString
in interfacePostInsertIdentityPersister
- Returns:
- The SQL command string
-
getSelectByUniqueKeyString
public String getSelectByUniqueKeyString(String propertyName)
Description copied from interface:PostInsertIdentityPersister
Get a SQL select string that performs a select based on a unique key determined by the given property name.- Specified by:
getSelectByUniqueKeyString
in interfacePostInsertIdentityPersister
- 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
public String getSelectByUniqueKeyString(String[] propertyNames)
Description copied from interface:PostInsertIdentityPersister
Get a SQL select string that performs a select based on a unique key determined by the given property names.- Specified by:
getSelectByUniqueKeyString
in interfacePostInsertIdentityPersister
- 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
-
update
public void update(Object id, Object[] values, int[] dirtyAttributeIndexes, boolean hasDirtyCollection, Object[] oldValues, Object oldVersion, Object object, Object rowId, SharedSessionContractImplementor session) throws HibernateException
Update an object- Specified by:
update
in interfaceEntityPersister
- Throws:
HibernateException
-
hasLazyDirtyFields
@Internal public boolean hasLazyDirtyFields(int[] dirtyFields)
-
getIdentityInsertDelegate
public InsertGeneratedIdentifierDelegate getIdentityInsertDelegate()
Description copied from interface:EntityMutationTarget
The delegate for executing inserts against the root table for targets defined using post-insert id generation- Specified by:
getIdentityInsertDelegate
in interfaceEntityMutationTarget
-
insert
public Object insert(Object[] fields, Object object, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Persist an instance, using a natively generated identifier (optional operation)- Specified by:
insert
in interfaceEntityPersister
-
insert
public void insert(Object id, Object[] fields, Object object, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Persist an instance- Specified by:
insert
in interfaceEntityPersister
-
getTableMappings
protected EntityTableMapping[] getTableMappings()
-
getTableMappingsCount
@Deprecated(since="6", forRemoval=true) public int getTableMappingsCount()
Deprecated, for removal: This API element is subject to removal in a future version.this method is no longer used
-
getTableMapping
public EntityTableMapping getTableMapping(int i)
-
physicalTableNameForMutation
public String physicalTableNameForMutation(SelectableMapping selectableMapping)
Unfortunately we cannot directly use `SelectableMapping#getContainingTableExpression()` as that blows up for attributes declared on super-type for union-subclass mappings
-
getPhysicalTableMappingForMutation
public EntityTableMapping getPhysicalTableMappingForMutation(SelectableMapping selectableMapping)
-
getTargetPart
public EntityMappingType getTargetPart()
Description copied from interface:MutationTarget
The ModelPart describing the mutation target- Specified by:
getTargetPart
in interfaceEntityMutationTarget
- Specified by:
getTargetPart
in interfaceMutationTarget<EntityTableMapping>
-
forEachMutableTable
public void forEachMutableTable(Consumer<EntityTableMapping> consumer)
Description copied from interface:MutationTarget
Visit each table.- Specified by:
forEachMutableTable
in interfaceMutationTarget<EntityTableMapping>
-
forEachMutableTableReverse
public void forEachMutableTableReverse(Consumer<EntityTableMapping> consumer)
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
public String getIdentifierTableName()
Description copied from interface:MutationTarget
The name of the table defining the identifier for this target- Specified by:
getIdentifierTableName
in interfaceMutationTarget<EntityTableMapping>
-
getIdentifierTableMapping
public 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
public ModelPart getIdentifierDescriptor()
Description copied from interface:EntityMutationTarget
The ModelPart describing the identifier/key for this target- Specified by:
getIdentifierDescriptor
in interfaceEntityMutationTarget
-
hasSkippableTables
public boolean hasSkippableTables()
Description copied from interface:EntityMutationTarget
Whether this target defines any potentially skippable tables.A table is considered potentially skippable if it is defined as inverse or as optional.
- Specified by:
hasSkippableTables
in interfaceEntityMutationTarget
- See Also:
Table.inverse()
,Table.optional()
-
hasAnySkippableTables
protected boolean hasAnySkippableTables(boolean[] optionalTables, boolean[] inverseTables)
-
delete
public void delete(Object id, Object version, Object object, SharedSessionContractImplementor session)
Delete an object- Specified by:
delete
in interfaceEntityPersister
-
isAllOrDirtyOptLocking
@Deprecated(since="6", forRemoval=true) protected boolean isAllOrDirtyOptLocking()
Deprecated, for removal: This API element is subject to removal in a future version.this method is no longer used
-
logStaticSQL
protected void logStaticSQL()
-
getSubclassByDiscriminatorValue
public abstract Map<Object,String> getSubclassByDiscriminatorValue()
-
needsDiscriminator
protected abstract boolean needsDiscriminator()
-
isDiscriminatorFormula
protected boolean isDiscriminatorFormula()
-
createRootTableGroup
public TableGroup createRootTableGroup(boolean canUseInnerJoins, NavigablePath navigablePath, String explicitSourceAlias, SqlAliasBase explicitSqlAliasBase, Supplier<Consumer<Predicate>> additionalPredicateCollectorAccess, SqlAstCreationState creationState)
Description copied from interface:RootTableGroupProducer
Create a root TableGroup as defined by this producer- Specified by:
createRootTableGroup
in interfaceEntityMappingType
- Specified by:
createRootTableGroup
in interfaceRootTableGroupProducer
- Parameters:
canUseInnerJoins
- Whether inner joins can be used when creating table-references within this groupnavigablePath
- The overall NavigablePath for the rootexplicitSourceAlias
- The alias, if one, explicitly provided by the application for this rootexplicitSqlAliasBase
- A specific SqlAliasBase to use. May benull
indicating one should be created using the SqlAliasBaseGenerator fromcreationState
additionalPredicateCollectorAccess
- Collector for additional predicates associated with this producercreationState
- The creation state
-
applyDiscriminator
public void applyDiscriminator(Consumer<Predicate> predicateConsumer, String alias, TableGroup tableGroup, SqlAstCreationState creationState)
Description copied from interface:Discriminatable
Apply the discriminator as a predicate via thepredicateConsumer
- Specified by:
applyDiscriminator
in interfaceDiscriminatable
- Specified by:
applyDiscriminator
in interfaceEntityMappingType
-
applyFilterRestrictions
public void applyFilterRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String,Filter> enabledFilters, 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, 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
-
applyWhereRestrictions
public void applyWhereRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, SqlAstCreationState creationState)
Description copied from interface:WhereRestrictable
Apply theWhere
restrictions- Specified by:
applyWhereRestrictions
in interfaceEntityMappingType
- Specified by:
applyWhereRestrictions
in interfaceWhereRestrictable
-
generateFilterConditionAlias
public String generateFilterConditionAlias(String rootAlias)
Description copied from interface:Queryable
The alias used for any filter conditions (mapped where-fragments or enabled-filters).This may or may not be different from the root alias depending upon the inheritance mapping strategy.
- Specified by:
generateFilterConditionAlias
in interfaceQueryable
- Parameters:
rootAlias
- The root alias- Returns:
- The alias used for "filter conditions" within the where clause.
-
shouldInnerJoinSubclassTable
protected boolean shouldInnerJoinSubclassTable(int subclassTableNumber, Set<String> treatAsDeclarations)
-
isSubclassTableIndicatedByTreatAsDeclarations
protected boolean isSubclassTableIndicatedByTreatAsDeclarations(int subclassTableNumber, Set<String> treatAsDeclarations)
-
postConstruct
protected void postConstruct(Metadata mapping) throws MappingException
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
-
buildTableMappings
protected EntityTableMapping[] 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
protected abstract boolean isIdentifierTable(String tableExpression)
-
buildInsertCoordinator
protected InsertCoordinator buildInsertCoordinator()
-
buildUpdateCoordinator
protected UpdateCoordinator buildUpdateCoordinator()
-
buildDeleteCoordinator
protected DeleteCoordinator buildDeleteCoordinator()
-
addDiscriminatorToInsertGroup
public void addDiscriminatorToInsertGroup(MutationGroupBuilder insertGroupBuilder)
-
postInstantiate
public final void postInstantiate() throws MappingException
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.
-
load
public Object 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
parameter- Specified by:
load
in interfaceEntityPersister
-
load
public Object load(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session) throws HibernateException
Load an instance using either theforUpdateLoader
or the outer joiningloader
, depending upon the value of thelock
parameter- Specified by:
load
in interfaceEntityPersister
- Throws:
HibernateException
-
load
public Object load(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session, Boolean readOnly) throws HibernateException
- Specified by:
load
in interfaceEntityPersister
- Throws:
HibernateException
-
getSingleIdLoader
public SingleIdEntityLoader<?> getSingleIdLoader()
-
initializeEnhancedEntityUsedAsProxy
public Object initializeEnhancedEntityUsedAsProxy(Object entity, String nameOfAttributeBeingAccessed, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
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.- Specified by:
initializeEnhancedEntityUsedAsProxy
in interfaceEntityPersister
-
multiLoad
public List<?> multiLoad(Object[] ids, EventSource session, MultiIdLoadOptions loadOptions)
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
public void registerAffectingFetchProfile(String fetchProfileName)
Description copied from interface:Loadable
Register the name of a fetch profile determined to have an affect on the underlying loadable in regards to the fact that the underlying load SQL needs to be adjust when the given fetch profile is enabled.- Specified by:
registerAffectingFetchProfile
in interfaceLoadable
- Parameters:
fetchProfileName
- The name of the profile affecting this.
-
registerAffectingFetchProfile
public void registerAffectingFetchProfile(String fetchProfileName, Fetch.Style fetchStyle)
Description copied from interface:FetchProfileAffectee
Register the profile name with the entity/collection- Specified by:
registerAffectingFetchProfile
in interfaceFetchProfileAffectee
-
isAffectedByEntityGraph
public boolean isAffectedByEntityGraph(LoadQueryInfluencers loadQueryInfluencers)
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
public boolean isAffectedByEnabledFetchProfiles(LoadQueryInfluencers loadQueryInfluencers)
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)
Description copied from interface:Loadable
Whether any of the "influencers" affect this loadable.- Specified by:
isAffectedByEnabledFilters
in interfaceEntityMappingType
- Specified by:
isAffectedByEnabledFilters
in interfaceLoadable
-
isSubclassPropertyNullable
public boolean isSubclassPropertyNullable(int i)
Description copied from interface:OuterJoinLoadable
Is the numbered property of the class of subclass nullable?- Specified by:
isSubclassPropertyNullable
in interfaceOuterJoinLoadable
-
findDirty
public int[] findDirty(Object[] currentState, Object[] previousState, Object entity, SharedSessionContractImplementor session) throws HibernateException
Locate the property-indices of all properties considered to be dirty.- Specified by:
findDirty
in interfaceEntityPersister
- Parameters:
currentState
- The current state of the entity (the state to be checked).previousState
- The previous state of the entity (the state to be checked against).entity
- The entity for which we are checking state dirtiness.session
- The session in which the check is occurring.- Returns:
null
or the indices of the dirty properties- Throws:
HibernateException
-
findModified
public int[] findModified(Object[] old, Object[] current, Object entity, SharedSessionContractImplementor session) throws HibernateException
Locate the property-indices of all properties considered to be dirty.- Specified by:
findModified
in interfaceEntityPersister
- Parameters:
old
- The old state of the entity.current
- The current state of the entity.entity
- The entity for which we are checking state modification.session
- The session in which the check is occurring.- Returns:
null
or the indices of the modified properties- Throws:
HibernateException
-
getPropertyUpdateability
public boolean[] getPropertyUpdateability(Object entity)
Which properties appear in the SQL update? (Initialized, updateable ones!)
-
getFactory
public SessionFactoryImplementor getFactory()
Description copied from interface:EntityPersister
Return theSessionFactory
to which this persister belongs.- Specified by:
getFactory
in interfaceEntityPersister
- Returns:
- The owning
SessionFactory
.
-
getEntityMetamodel
public EntityMetamodel 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
public EntityDataAccess getCacheAccessStrategy()
Description copied from interface:EntityPersister
Get the cache (optional operation)- Specified by:
getCacheAccessStrategy
in interfaceEntityPersister
-
getCacheEntryStructure
public CacheEntryStructure getCacheEntryStructure()
Description copied from interface:EntityPersister
Get the cache structure- Specified by:
getCacheEntryStructure
in interfaceEntityPersister
-
buildCacheEntry
public CacheEntry buildCacheEntry(Object entity, Object[] state, Object version, SharedSessionContractImplementor session)
- Specified by:
buildCacheEntry
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
public NaturalIdDataAccess getNaturalIdCacheAccessStrategy()
Description copied from interface:EntityPersister
Get the NaturalId cache (optional operation)- Specified by:
getNaturalIdCacheAccessStrategy
in interfaceEntityPersister
-
getEntityName
public final String getEntityName()
Description copied from interface:EntityMappingType
The entity name. For most entities, this will be the fully-qualified name of the entity class. The alternative is an explicit entity-name which takes precedence if provided- Specified by:
getEntityName
in interfaceClassMetadata
- Specified by:
getEntityName
in interfaceEntityMappingType
- Specified by:
getEntityName
in interfaceEntityPersister
- Returns:
- The name of the entity which this persister maps.
-
getEntityType
public EntityType getEntityType()
- Specified by:
getEntityType
in interfaceOuterJoinLoadable
-
isPolymorphic
public boolean isPolymorphic()
-
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 interfaceClassMetadata
- 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 interfaceClassMetadata
- Specified by:
hasIdentifierProperty
in interfaceEntityPersister
- Returns:
- True if the entity has a specific property holding identifier value.
-
getVersionType
public BasicType<?> 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 interfaceClassMetadata
- 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 interfaceClassMetadata
- 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.
-
afterReassociate
public void afterReassociate(Object entity, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Called just after the entity has been reassociated with the session- Specified by:
afterReassociate
in interfaceEntityPersister
-
isTransient
public Boolean isTransient(Object entity, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:EntityPersister
Is this a new transient instance?- Specified by:
isTransient
in interfaceEntityPersister
- Throws:
HibernateException
-
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 interfaceClassMetadata
- 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
- Specified by:
isAbstract
in interfaceLoadable
- Specified by:
isAbstract
in interfaceQueryable
- See Also:
EntityMappingType.isAbstract()
-
hasSubclasses
public boolean hasSubclasses()
Description copied from interface:EntityMappingType
Whether this entity mapping has any subtype mappings- Specified by:
hasSubclasses
in interfaceClassMetadata
- Specified by:
hasSubclasses
in interfaceEntityMappingType
- Specified by:
hasSubclasses
in interfaceLoadable
-
hasProxy
public boolean hasProxy()
Description copied from interface:EntityPersister
Determine whether this entity supports dynamic proxies.- Specified by:
hasProxy
in interfaceClassMetadata
- Specified by:
hasProxy
in interfaceEntityPersister
- Returns:
- True if the entity has dynamic proxy support; false otherwise.
-
getIdentifierGenerator
@Deprecated public IdentifierGenerator getIdentifierGenerator() throws HibernateException
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
public Generator getGenerator()
- Specified by:
getGenerator
in interfaceEntityPersister
-
getVersionGenerator
public BeforeExecutionGenerator getVersionGenerator()
- Specified by:
getVersionGenerator
in interfaceEntityPersister
-
getRootEntityName
public String 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.
-
getClassMetadata
@Deprecated public ClassMetadata getClassMetadata()
Deprecated.Description copied from interface:EntityPersister
Get the user-visible metadata for the class (optional operation)- Specified by:
getClassMetadata
in interfaceEntityPersister
-
getMappedSuperclass
public String 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
- Specified by:
getMappedSuperclass
in interfaceQueryable
- See Also:
EntityMappingType.getSuperMappingType()
-
isExplicitPolymorphism
public boolean isExplicitPolymorphism()
Description copied from interface:EntityMappingType
Is this class explicit polymorphism only?- Specified by:
isExplicitPolymorphism
in interfaceEntityMappingType
- Specified by:
isExplicitPolymorphism
in interfaceQueryable
- See Also:
EntityMappingType.isExplicitPolymorphism()
-
getKeyColumnNames
public String[] getKeyColumnNames()
Description copied from interface:Joinable
The columns to join on- Specified by:
getKeyColumnNames
in interfaceJoinable
-
getName
public String getName()
Description copied from interface:Joinable
An identifying name; a class name or collection role name.
-
isCollection
public boolean isCollection()
Description copied from interface:Joinable
Is this instance actually a CollectionPersister?- Specified by:
isCollection
in interfaceJoinable
-
consumesEntityAlias
public boolean consumesEntityAlias()
Description copied from interface:Joinable
Very, very, very ugly...- Specified by:
consumesEntityAlias
in interfaceJoinable
- Returns:
- Does this persister "consume" entity column aliases in the result set?
-
consumesCollectionAlias
public boolean consumesCollectionAlias()
Description copied from interface:Joinable
Very, very, very ugly...- Specified by:
consumesCollectionAlias
in interfaceJoinable
- Returns:
- Does this persister "consume" collection column aliases in the result set?
-
getPropertyType
@Deprecated public Type getPropertyType(String propertyName) throws MappingException
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 interfaceClassMetadata
- 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.
-
getType
public Type getType()
Description copied from interface:SQLLoadable
Get the type- Specified by:
getType
in interfaceSQLLoadable
-
isSelectBeforeUpdateRequired
public boolean isSelectBeforeUpdateRequired()
Description copied from interface:EntityPersister
Is select snapshot before update enabled?- Specified by:
isSelectBeforeUpdateRequired
in interfaceEntityPersister
-
optimisticLockStyle
public final OptimisticLockStyle optimisticLockStyle()
Description copied from interface:EntityMappingType
The type of optimistic locking, if any, defined for this entity mapping- Specified by:
optimisticLockStyle
in interfaceEntityMappingType
-
createProxy
public Object createProxy(Object id, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:EntityPersister
Create a new proxy instance- Specified by:
createProxy
in interfaceEntityPersister
- Throws:
HibernateException
-
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.
-
isVersionPropertyInsertable
public boolean isVersionPropertyInsertable()
Description copied from interface:Queryable
Is the version property included in insert statements?- Specified by:
isVersionPropertyInsertable
in interfaceQueryable
-
isVersionGeneratedOnExecution
public boolean isVersionGeneratedOnExecution()
-
isVersionGeneratedBeforeExecution
public boolean isVersionGeneratedBeforeExecution()
-
afterInitialize
public void afterInitialize(Object entity, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Called just after the entities properties have been initialized- Specified by:
afterInitialize
in interfaceEntityPersister
-
getPropertyNames
public String[] 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 interfaceClassMetadata
- Specified by:
getPropertyNames
in interfaceEntityPersister
-
getPropertyTypes
public Type[] getPropertyTypes()
Description copied from interface:EntityPersister
Get the Hibernate types of the class properties- Specified by:
getPropertyTypes
in interfaceClassMetadata
- Specified by:
getPropertyTypes
in interfaceEntityPersister
-
getPropertyLaziness
public boolean[] getPropertyLaziness()
Description copied from interface:ClassMetadata
Get the "laziness" of the properties of this class- Specified by:
getPropertyLaziness
in interfaceClassMetadata
- 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()
-
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 interfaceClassMetadata
- 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
public CascadeStyle[] 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
public final Class<?> getMappedClass()
Description copied from interface:EntityPersister
The persistent class, or null- Specified by:
getMappedClass
in interfaceClassMetadata
- Specified by:
getMappedClass
in interfaceEntityPersister
-
implementsLifecycle
public boolean implementsLifecycle()
Description copied from interface:EntityPersister
Does the class implement theLifecycle
interface?- Specified by:
implementsLifecycle
in interfaceClassMetadata
- Specified by:
implementsLifecycle
in interfaceEntityPersister
-
getConcreteProxyClass
public Class<?> 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
public void setPropertyValues(Object object, Object[] values)
Description copied from interface:EntityPersister
Set the given values to the mapped properties of the given object.- Specified by:
setPropertyValues
in interfaceClassMetadata
- Specified by:
setPropertyValues
in interfaceEntityPersister
-
setPropertyValue
public void setPropertyValue(Object object, int i, Object value)
Description copied from interface:EntityPersister
Set the value of a particular property of the given instance.- Specified by:
setPropertyValue
in interfaceEntityPersister
-
getPropertyValues
public Object[] getPropertyValues(Object object)
Description copied from interface:ClassMetadata
Extract the property values from the given entity.- Specified by:
getPropertyValues
in interfaceClassMetadata
- Specified by:
getPropertyValues
in interfaceEntityPersister
- Parameters:
object
- The entity from which to extract the property values.- Returns:
- The property values.
-
getPropertyValue
public Object getPropertyValue(Object object, int i)
- Specified by:
getPropertyValue
in interfaceEntityPersister
-
getPropertyValue
public Object getPropertyValue(Object object, String propertyName)
Description copied from interface:EntityPersister
Get the value of a particular property- Specified by:
getPropertyValue
in interfaceClassMetadata
- Specified by:
getPropertyValue
in interfaceEntityPersister
-
getIdentifier
public Object getIdentifier(Object entity, SharedSessionContractImplementor session)
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.- Specified by:
getIdentifier
in interfaceClassMetadata
- Specified by:
getIdentifier
in interfaceEntityPersister
- Parameters:
entity
- The entity for which to get the identifiersession
- The session from which the request originated- Returns:
- The identifier
-
setIdentifier
public void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Inject the identifier value into the given entity.- Specified by:
setIdentifier
in interfaceClassMetadata
- Specified by:
setIdentifier
in interfaceEntityPersister
- Parameters:
entity
- The entity to inject with the identifier value.id
- The value to be injected as the identifier.session
- The session from which is requests originates
-
getVersion
public Object getVersion(Object object)
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 interfaceClassMetadata
- Specified by:
getVersion
in interfaceEntityPersister
-
instantiate
public Object instantiate(Object id, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Create a class instance initialized with the given identifier- Specified by:
instantiate
in interfaceClassMetadata
- Specified by:
instantiate
in interfaceEntityPersister
- Parameters:
id
- The identifier value to use (may be null to represent no value)session
- The session from which the request originated.- Returns:
- The instantiated entity.
-
linkToSession
protected void linkToSession(Object entity, SharedSessionContractImplementor session)
-
isInstance
public boolean isInstance(Object object)
Description copied from interface:EntityPersister
Is the given object an instance of this entity?- Specified by:
isInstance
in interfaceEntityPersister
-
hasUninitializedLazyProperties
public boolean hasUninitializedLazyProperties(Object object)
Description copied from interface:EntityPersister
Does the given instance have any uninitialized lazy properties?- Specified by:
hasUninitializedLazyProperties
in interfaceEntityPersister
-
resetIdentifier
public void resetIdentifier(Object entity, Object currentId, Object currentVersion, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
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.- Specified by:
resetIdentifier
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
-
isMultiTable
@Deprecated(since="6.0") public boolean isMultiTable()
Deprecated.Description copied from interface:Queryable
Is the inheritance hierarchy described by this persister contained across multiple tables?- Specified by:
isMultiTable
in interfaceQueryable
- Returns:
- True if the inheritance hierarchy is spread across multiple tables; false otherwise.
-
hasMultipleTables
protected boolean hasMultipleTables()
-
getPropertySpan
public int getPropertySpan()
-
getPropertyValuesToInsert
public Object[] getPropertyValuesToInsert(Object entity, Map<Object,Object> mergeMap, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:EntityPersister
Return the values of the insertable properties of the object (including backrefs)- Specified by:
getPropertyValuesToInsert
in interfaceClassMetadata
- Specified by:
getPropertyValuesToInsert
in interfaceEntityPersister
- Throws:
HibernateException
-
shouldGetAllProperties
protected boolean shouldGetAllProperties(Object entity)
-
processInsertGeneratedProperties
public void processInsertGeneratedProperties(Object id, Object entity, Object[] state, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Perform a select to retrieve the values of any generated properties back from the database, injecting these generated values into the given entity as well as writing this state to thePersistenceContext
.Note, that because we update the PersistenceContext here, callers need to take care that they have already written the initial snapshot to the PersistenceContext before calling this method.
- Specified by:
processInsertGeneratedProperties
in interfaceEntityPersister
-
processUpdateGeneratedProperties
public void processUpdateGeneratedProperties(Object id, Object entity, Object[] state, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Perform a select to retrieve the values of any generated properties back from the database, injecting these generated values into the given entity as well as writing this state to thePersistenceContext
.Note, that because we update the PersistenceContext here, callers need to take care that they have already written the initial snapshot to the PersistenceContext before calling this method.
- Specified by:
processUpdateGeneratedProperties
in interfaceEntityPersister
-
getIdentifierPropertyName
public String 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 interfaceClassMetadata
- Specified by:
getIdentifierPropertyName
in interfaceEntityPersister
-
getIdentifierType
public Type getIdentifierType()
Description copied from interface:EntityPersister
Get the identifier type- Specified by:
getIdentifierType
in interfaceClassMetadata
- 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 interfaceClassMetadata
- 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()
-
getNaturalIdentifierSnapshot
public Object getNaturalIdentifierSnapshot(Object id, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Retrieve the current state of the natural-id properties from the database.- Specified by:
getNaturalIdentifierSnapshot
in interfaceEntityPersister
- Parameters:
id
- The identifier of the entity for which to retrieve the natural-id values.session
- The session from which the request originated.- Returns:
- The natural-id snapshot.
-
getNaturalIdLoader
public NaturalIdLoader<?> 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
public MultiNaturalIdLoader<?> 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
-
loadEntityIdByNaturalId
public Object loadEntityIdByNaturalId(Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Load the id for the entity based on the natural id.- Specified by:
loadEntityIdByNaturalId
in interfaceEntityPersister
-
hasNaturalIdentifier
public boolean hasNaturalIdentifier()
Description copied from interface:EntityPersister
Determine whether this entity defines a natural identifier.- Specified by:
hasNaturalIdentifier
in interfaceClassMetadata
- Specified by:
hasNaturalIdentifier
in interfaceEntityPersister
- Returns:
- True if the entity defines a natural id; false otherwise.
-
setPropertyValue
public void setPropertyValue(Object object, String propertyName, Object value)
Description copied from interface:ClassMetadata
Set the value of a particular (named) property- Specified by:
setPropertyValue
in interfaceClassMetadata
-
getRepresentationStrategy
public EntityRepresentationStrategy 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
public BytecodeEnhancementMetadata getInstrumentationMetadata()
- Specified by:
getInstrumentationMetadata
in interfaceEntityPersister
-
getBytecodeEnhancementMetadata
public BytecodeEnhancementMetadata getBytecodeEnhancementMetadata()
- Specified by:
getBytecodeEnhancementMetadata
in interfaceEntityPersister
-
getTableAliasForColumn
public String getTableAliasForColumn(String columnName, String rootAlias)
Description copied from interface:Loadable
Given a column name and the root table alias in use for the entity hierarchy, determine the proper table alias for the table in that hierarchy that contains said column.- Specified by:
getTableAliasForColumn
in interfaceLoadable
- Parameters:
columnName
- The column namerootAlias
- The hierarchy root alias- Returns:
- The proper table alias for qualifying the given column.
-
determineTableNumberForColumn
public int determineTableNumberForColumn(String columnName)
-
getEntityEntryFactory
public EntityEntryFactory 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
public void forEachAttributeMapping(Consumer<? super AttributeMapping> action)
Description copied from interface:EntityMappingType
Visit each attribute mapping- Specified by:
forEachAttributeMapping
in interfaceEntityMappingType
- Specified by:
forEachAttributeMapping
in interfaceManagedMappingType
- See Also:
EntityMappingType.getAttributeMappings()
-
forEachAttributeMapping
public void forEachAttributeMapping(IndexedConsumer<? super AttributeMapping> consumer)
Description copied from interface:ManagedMappingType
Visit attributes defined on this class and any supers- Specified by:
forEachAttributeMapping
in interfaceManagedMappingType
-
prepareMappingModel
public void prepareMappingModel(MappingModelCreationProcess creationProcess)
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
public SqmMultiTableMutationStrategy 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
public SqmMultiTableInsertStrategy getSqmMultiTableInsertStrategy()
- Specified by:
getSqmMultiTableInsertStrategy
in interfaceEntityMappingType
- Specified by:
getSqmMultiTableInsertStrategy
in interfaceEntityPersister
-
getStateArrayInitialPosition
protected int getStateArrayInitialPosition(MappingModelCreationProcess creationProcess)
-
isPhysicalDiscriminator
protected boolean isPhysicalDiscriminator()
-
generateDiscriminatorMapping
protected EntityDiscriminatorMapping generateDiscriminatorMapping(PersistentClass bootEntityDescriptor, MappingModelCreationProcess modelCreationProcess)
-
getDiscriminatorType
public abstract BasicType<?> getDiscriminatorType()
Description copied from interface:Loadable
Get the discriminator type- Specified by:
getDiscriminatorType
in interfaceLoadable
-
generateVersionMapping
protected EntityVersionMapping generateVersionMapping(Supplier<?> templateInstanceCreator, PersistentClass bootEntityDescriptor, MappingModelCreationProcess creationProcess)
-
shouldProcessSuperMapping
protected boolean shouldProcessSuperMapping()
-
linkWithSuperType
public void linkWithSuperType(MappingModelCreationProcess creationProcess)
Description copied from interface:InFlightEntityMappingType
Link an entity type with its super-type, if one.- Specified by:
linkWithSuperType
in interfaceInFlightEntityMappingType
-
linkWithSubType
public void linkWithSubType(EntityMappingType sub, MappingModelCreationProcess creationProcess)
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
public AttributeMapping getAttributeMapping(int position)
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
public AttributeMappingsMap 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
public void visitDeclaredAttributeMappings(Consumer<? super AttributeMapping> action)
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
public EntityMappingType 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
public Collection<EntityMappingType> getSubMappingTypes()
Description copied from interface:EntityMappingType
Retrieve mappings for all subtypes- Specified by:
getSubMappingTypes
in interfaceEntityMappingType
-
isTypeOrSuperType
public boolean isTypeOrSuperType(EntityMappingType targetType)
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
-
buildSingularAssociationAttributeMapping
protected 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 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
public JavaType<?> 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
public EntityPersister getEntityPersister()
Description copied from interface:EntityMappingType
Safety-net.- Specified by:
getEntityPersister
in interfaceEntityMappingType
-
getIdentifierMapping
public EntityIdentifierMapping 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
public EntityVersionMapping 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:
EntityMappingType.optimisticLockStyle()
-
getRowIdMapping
public EntityRowIdMapping 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
public EntityDiscriminatorMapping 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 interfaceDiscriminatable
- Specified by:
getDiscriminatorMapping
in interfaceEntityMappingType
-
getAttributeMappings
public AttributeMappingsList 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
public AttributeMapping findDeclaredAttributeMapping(String name)
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
public AttributeMapping findAttributeMapping(String name)
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
public ModelPart findSubPart(String name, EntityMappingType treatTargetType)
- Specified by:
findSubPart
in interfaceEntityValuedModelPart
- Specified by:
findSubPart
in interfaceModelPartContainer
-
findSubTypesSubPart
public ModelPart findSubTypesSubPart(String name, EntityMappingType treatTargetType)
- Specified by:
findSubTypesSubPart
in interfaceEntityMappingType
-
visitSubParts
public void visitSubParts(Consumer<ModelPart> consumer, EntityMappingType treatTargetType)
- 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
-
getNumberOfKeyFetchables
public int getNumberOfKeyFetchables()
Description copied from interface:FetchableContainer
The number of key fetchables in the container- Specified by:
getNumberOfKeyFetchables
in interfaceFetchableContainer
-
getKeyFetchable
public Fetchable getKeyFetchable(int position)
- Specified by:
getKeyFetchable
in interfaceFetchableContainer
-
getFetchable
public Fetchable getFetchable(int position)
- 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
protected AttributeMappingsList getStaticFetchableList()
-
visitAttributeMappings
public void visitAttributeMappings(Consumer<? super AttributeMapping> action, EntityMappingType targetType)
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
public void visitSuperTypeAttributeMappings(Consumer<? super AttributeMapping> action)
Description copied from interface:EntityMappingType
Walk this type's attributes as well as its super-type's- Specified by:
visitSuperTypeAttributeMappings
in interfaceEntityMappingType
-
forEachSelectable
public int forEachSelectable(int offset, SelectableConsumer selectableConsumer)
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
public void visitSubTypeAttributeMappings(Consumer<? super AttributeMapping> action)
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
public int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)
Description copied from interface:JdbcMappingContainer
Visit each JdbcMapping starting from the given offset- Specified by:
forEachJdbcType
in interfaceEntityValuedModelPart
- Specified by:
forEachJdbcType
in interfaceJdbcMappingContainer
-
disassemble
public Object disassemble(Object value, SharedSessionContractImplementor session)
- Specified by:
disassemble
in interfaceBindable
- Specified by:
disassemble
in interfaceEntityValuedModelPart
- See Also:
As an example, consider the following domain model: ````
-
forEachDisassembledJdbcValue
public <X,Y> int forEachDisassembledJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> valuesConsumer, SharedSessionContractImplementor session)
Description copied from interface:Bindable
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)
.- Specified by:
forEachDisassembledJdbcValue
in interfaceBindable
- Specified by:
forEachDisassembledJdbcValue
in interfaceEntityValuedModelPart
-
forEachJdbcValue
public <X,Y> int forEachJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> consumer, SharedSessionContractImplementor session)
Description copied from interface:Bindable
Visit each constituent JDBC value extracted from the entity instance itself. Short-hand form of callingBindable.disassemble(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor)
and piping its result toBindable.forEachDisassembledJdbcValue(Object, int, JdbcValuesConsumer, SharedSessionContractImplementor)
- Specified by:
forEachJdbcValue
in interfaceBindable
- Specified by:
forEachJdbcValue
in interfaceEntityValuedModelPart
-
hasPartitionedSelectionMapping
public boolean hasPartitionedSelectionMapping()
- Specified by:
hasPartitionedSelectionMapping
in interfaceManagedMappingType
- Specified by:
hasPartitionedSelectionMapping
in interfaceModelPart
-
isInsertCallable
@Deprecated(since="6", forRemoval=true) public boolean isInsertCallable(int j)
Deprecated, for removal: This API element is subject to removal in a future version.With no replacement
-
isUpdateCallable
@Deprecated(since="6", forRemoval=true) public boolean isUpdateCallable(int j)
Deprecated, for removal: This API element is subject to removal in a future version.With no replacement
-
isDeleteCallable
@Deprecated(since="6", forRemoval=true) public boolean isDeleteCallable(int j)
Deprecated, for removal: This API element is subject to removal in a future version.With no replacement
-
isSubclassTableSequentialSelect
@Deprecated(since="6", forRemoval=true) protected boolean isSubclassTableSequentialSelect(int j)
Deprecated, for removal: This API element is subject to removal in a future version.With no replacement
-
getElementTypeDescriptor
@Deprecated(since="6", forRemoval=true) public EntityMappingType getElementTypeDescriptor()
Deprecated, for removal: This API element is subject to removal in a future version.With no replacement.
-
isTableCascadeDeleteEnabled
@Deprecated(forRemoval=true) @Remove public abstract @org.hibernate.Remove boolean isTableCascadeDeleteEnabled(int j)
Deprecated, for removal: This API element is subject to removal in a future version.No longer used
-
isInverseSubclassTable
@Deprecated(forRemoval=true) @Remove protected @org.hibernate.Remove boolean isInverseSubclassTable(int j)
Deprecated, for removal: This API element is subject to removal in a future version.No longer used
-
getSQLDeleteStrings
@Deprecated(forRemoval=true) @Remove public @Remove String[] getSQLDeleteStrings()
Deprecated, for removal: This API element is subject to removal in a future version.No longer used. SeegetDeleteCoordinator()
-
getSQLUpdateStrings
@Deprecated(forRemoval=true) @Remove public @Remove String[] getSQLUpdateStrings()
Deprecated, for removal: This API element is subject to removal in a future version.No longer used. SeegetUpdateCoordinator()
-
getTableUpdateNeeded
@Deprecated(forRemoval=true) @Remove public @org.hibernate.Remove boolean[] getTableUpdateNeeded(int[] dirtyProperties, boolean hasDirtyCollection)
Deprecated, for removal: This API element is subject to removal in a future version.No longer used. SeeUpdateCoordinator
Decide which tables need to be updated.The return here is an array of boolean values with each index corresponding to a given table in the scope of this persister.
- Parameters:
dirtyProperties
- The indices of all the entity properties considered dirty.hasDirtyCollection
- Whether any collections owned by the entity which were considered dirty.- Returns:
- Array of booleans indicating which table require updating.
-
isBatchable
@Deprecated(forRemoval=true) @Remove public @org.hibernate.Remove boolean isBatchable()
Deprecated, for removal: This API element is subject to removal in a future version.No longer used. SeeMutationExecutorService
-
generateDeleteString
@Deprecated(forRemoval=true) @Remove public @Remove String generateDeleteString(int j)
Deprecated, for removal: This API element is subject to removal in a future version.No longer used. SeeDeleteCoordinator
Generate the SQL that deletes a row by id (and version)
-
dehydrate
@Deprecated(forRemoval=true) @Remove public @org.hibernate.Remove int dehydrate(Object id, Object[] fields, Object rowId, boolean[] includeProperty, boolean[][] includeColumns, int j, PreparedStatement ps, SharedSessionContractImplementor session, int index, boolean isUpdate) throws SQLException, HibernateException
Deprecated, for removal: This API element is subject to removal in a future version.No longer used.Marshall the fields of a persistent instance to a prepared statement- Throws:
SQLException
HibernateException
-
generateSQLDeleteStrings
@Deprecated(since="6.2", forRemoval=true) @Remove protected @Remove String[] generateSQLDeleteStrings(Object[] loadedState)
Deprecated, for removal: This API element is subject to removal in a future version.
-
isAllNull
@Deprecated(since="6.2", forRemoval=true) @Remove public final @org.hibernate.Remove boolean isAllNull(Object[] array, int tableNumber)
Deprecated, for removal: This API element is subject to removal in a future version.
-
getSubclassColumnAliasClosure
@Deprecated protected String[] getSubclassColumnAliasClosure()
Deprecated.Hibernate no longer uses aliases to read from result sets
-
getSubclassFormulaAliasClosure
@Deprecated protected String[] getSubclassFormulaAliasClosure()
Deprecated.Hibernate no longer uses aliases to read from result sets
-
getSubclassPropertyColumnAliases
@Deprecated public String[] getSubclassPropertyColumnAliases(String propertyName, String suffix)
Deprecated.Hibernate no longer uses aliases to read from result setsDescription copied from interface:SQLLoadable
Return the column alias names used to persist/query the named property of the class or a subclass (optional operation).- Specified by:
getSubclassPropertyColumnAliases
in interfaceSQLLoadable
-
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
-
getLazyPropertyColumnAliases
@Deprecated protected String[][] getLazyPropertyColumnAliases()
Deprecated.Hibernate no longer uses aliases to read from result setsCalled by Hibernate Reactive
-
getDiscriminatorAlias
@Deprecated public String getDiscriminatorAlias()
Deprecated.Hibernate no longer uses aliases to read from result sets
-
-