Class AbstractCollectionPersister
- java.lang.Object
-
- org.hibernate.persister.collection.AbstractCollectionPersister
-
- All Implemented Interfaces:
FetchProfileAffectee
,CollectionMetadata
,FilterRestrictable
,PluralAttributeMappingImpl.Aware
,Restrictable
,WhereRestrictable
,CollectionPersister
,DeprecatedCollectionStuff
,CollectionMutationTarget
,QueryableCollection
,SQLLoadableCollection
,Joinable
,PropertyMapping
,MutationTarget<CollectionTableMapping>
- Direct Known Subclasses:
BasicCollectionPersister
,OneToManyPersister
@Internal public abstract class AbstractCollectionPersister extends Object implements CollectionPersister, CollectionMutationTarget, PluralAttributeMappingImpl.Aware, FetchProfileAffectee, DeprecatedCollectionStuff
Base implementation of theQueryableCollection
interface.- See Also:
BasicCollectionPersister
,OneToManyPersister
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description AbstractCollectionPersister(Collection collectionBootDescriptor, @Nullable CollectionDataAccess cacheAccessStrategy, RuntimeModelCreationContext creationContext)
AbstractCollectionPersister(Collection collectionBootDescriptor, @Nullable CollectionDataAccess cacheAccessStrategy, PersisterCreationContext creationContext)
Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
applyBaseManyToManyRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String,Filter> enabledFilters, Set<String> treatAsDeclarations, SqlAstCreationState creationState)
void
applyBaseRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String,Filter> enabledFilters, boolean onlyApplyLoadByKeyFilters, Set<String> treatAsDeclarations, SqlAstCreationState creationState)
Applies the base set of restrictions.void
applyBaseRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String,Filter> enabledFilters, Set<String> treatAsDeclarations, SqlAstCreationState creationState)
Applies the base set of restrictions.void
applyFilterRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String,Filter> enabledFilters, boolean onlyApplyLoadByKeyFilters, SqlAstCreationState creationState)
Applies just theFilter
values enabled for the associated entityprotected void
applyKeyRestrictions(MutatingTableReference tableReference, ColumnValueParameterList parameterList, List<ColumnValueBinding> restrictionBindings)
protected void
applyWhereFragments(Consumer<Predicate> predicateConsumer, String alias, TableGroup tableGroup, SqlAstCreationState astCreationState)
void
applyWhereRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, SqlAstCreationState creationState)
Apply theWhere
restrictionsprotected JdbcMutationOperation
buildDeleteAllOperation(MutatingTableReference tableReference)
protected CollectionLoader
createNamedQueryCollectionLoader(CollectionPersister persister, NamedQueryMemento namedQueryMemento)
For Hibernate Reactiveprotected CollectionLoader
createSingleKeyCollectionLoader(LoadQueryInfluencers loadQueryInfluencers)
For Hibernate Reactiveprotected CollectionLoader
createSubSelectLoader(SubselectFetch subselect, SharedSessionContractImplementor session)
protected @Remove Object
decrementIndexByBase(Object index)
Deprecated, for removal: This API element is subject to removal in a future version.No longer used.protected CollectionLoader
determineLoaderToUse(Object key, SharedSessionContractImplementor session)
protected String
determineTableName(Table table)
protected abstract void
doProcessQueuedOps(PersistentCollection<?> collection, Object key, SharedSessionContractImplementor session)
boolean
elementExists(Object key, Object element, SharedSessionContractImplementor session)
void
forEachMutableTable(Consumer<CollectionTableMapping> consumer)
Visit each table.void
forEachMutableTableReverse(Consumer<CollectionTableMapping> consumer)
Same asMutationTarget.forEachMutableTable(java.util.function.Consumer<T>)
except that here the tables are visited in reverse orderRestrictedTableMutation<JdbcMutationOperation>
generateDeleteAllAst(MutatingTableReference tableReference)
protected String
generateDetectRowByElementString()
protected String
generateDetectRowByIndexString()
protected String
generateSelectSizeString(boolean isIntegerIndexed)
PluralAttributeMapping
getAttributeMapping()
int
getBatchSize()
CollectionDataAccess
getCacheAccessStrategy()
Access to the collection's cache regionCacheEntryStructure
getCacheEntryStructure()
Get the structure used to store data into the collection's cache regionCollectionLoader
getCollectionLoader()
CollectionMetadata
getCollectionMetadata()
Deprecated.String[]
getCollectionPropertyColumnAliases(String propertyName, String suffix)
CollectionSemantics<?,?>
getCollectionSemantics()
String[]
getCollectionSpaces()
Get the "space" that holds the persistent stateCollectionTableMapping
getCollectionTableMapping()
CollectionType
getCollectionType()
Get the associatedType
protected Dialect
getDialect()
Object
getElementByIndex(Object key, Object index, SharedSessionContractImplementor session, Object owner)
Class<?>
getElementClass()
Return the element class of an array, or null otherwise.String[]
getElementColumnAliases(String suffix)
Generates the collection's element column aliases, based on the given suffix.String[]
getElementColumnNames()
Get the names of the collection element columns (or the primary key columns in the case of a one-to-many association)String[]
getElementColumnNames(String alias)
Get the names of the collection element columns (or the primary key columns in the case of a one-to-many association), aliased by the given table aliasEntityPersister
getElementPersister()
Get the persister of the element class, if this is a collection of entities (optional operation).protected EntityPersister
getElementPersisterInternal()
Type
getElementType()
Get the "element" typeSessionFactoryImplementor
getFactory()
FetchMode
getFetchMode()
Should we load this collection role by outerjoining?abstract FilterAliasGenerator
getFilterAliasGenerator(String rootAlias)
abstract FilterAliasGenerator
getFilterAliasGenerator(TableGroup tableGroup)
BeforeExecutionGenerator
getGenerator()
Get the surrogate key generation strategy (optional operation)String
getIdentifierColumnAlias(String suffix)
Generates the collection's identifier column aliases, based on the given suffix.String
getIdentifierColumnName()
IdentifierGenerator
getIdentifierGenerator()
Deprecated.String
getIdentifierTableName()
The name of the table defining the identifier for this targetType
getIdentifierType()
Get the type of the surrogate keyString[]
getIndexColumnAliases(String suffix)
Generates the collection's index column aliases, based on the given suffix.String[]
getIndexColumnNames()
Get the names of the collection index columns if this is an indexed collection (optional operation)String[]
getIndexColumnNames(String alias)
Get the names of the collection index columns if this is an indexed collection (optional operation), aliased by the given table aliasString[]
getIndexFormulas()
Get the index formulas if this is an indexed collection (optional operation)Type
getIndexType()
Get the "index" type for a list or map (optional operation)String[]
getKeyColumnAliases(String suffix)
Generates the collection's key column aliases, based on the given suffix.String[]
getKeyColumnNames()
The columns to join onType
getKeyType()
Get the "key" type (the type of the foreign key)String
getManyToManyFilterFragment(TableGroup tableGroup, Map<String,Filter> enabledFilters)
String
getManyToManyOrderByString(String alias)
Get the order-by to be applied at the target table of a many to manyString
getMappedByProperty()
String
getName()
An identifying name; a class name or collection role name.NavigableRole
getNavigableRole()
The NavigableRole for this collection.String
getOwnerEntityName()
EntityPersister
getOwnerEntityPersister()
Get the persister of the entity that "owns" this collectionprotected abstract RemoveCoordinator
getRemoveCoordinator()
protected abstract RowMutationOperations
getRowMutationOperations()
int
getSize(Object key, SharedSessionContractImplementor session)
Comparator<?>
getSortingComparator()
For sorted collections, the comparator to use.protected SqlExceptionHelper
getSQLExceptionHelper()
String
getSQLOrderByString(String alias)
Get the order by SQLString
getTableName()
The table to join to.PluralAttributeMapping
getTargetPart()
The ModelPart describing the mutation targetboolean
hasCache()
Is this collection role cacheableboolean
hasIndex()
Is this an "indexed" collection? (list or map)boolean
hasManyToManyOrdering()
boolean
hasOrdering()
Is this an ordered collection? (An ordered collection is ordered by the initialization operation, not by sorting that happens in memory, as in the case of a sorted collection.)boolean
hasOrphanDelete()
Does this collection implement "orphan delete"?boolean
hasPhysicalIndexColumn()
Whether the collection has at least one physical index columnboolean
hasWhere()
Does this collection role have a where clause filter?boolean
hasWhereRestrictions()
Does this restrictable have a where restriction?protected Object
incrementIndexByBase(Object index)
boolean
indexExists(Object key, Object index, SharedSessionContractImplementor session)
void
initCollectionPropertyMap()
void
initialize(Object key, SharedSessionContractImplementor session)
Initialize the given collection with the given keyvoid
injectAttributeMapping(PluralAttributeMapping attributeMapping)
Allows injection of the corresponding plural-attribute mapping.boolean
isAffectedByEnabledFetchProfiles(LoadQueryInfluencers influencers)
boolean
isAffectedByEnabledFilters(Set<ManagedMappingType> visitedTypes, LoadQueryInfluencers influencers, boolean onlyApplyForLoadByKeyFilters)
boolean
isAffectedByEnabledFilters(LoadQueryInfluencers influencers)
boolean
isAffectedByEnabledFilters(LoadQueryInfluencers influencers, boolean onlyApplyForLoadByKeyFilters)
boolean
isAffectedByEnabledFilters(SharedSessionContractImplementor session)
boolean
isAffectedByEntityGraph(LoadQueryInfluencers influencers)
boolean
isArray()
Is this an array?boolean
isBatchLoadable()
boolean
isCascadeDeleteEnabled()
Is cascade delete handled by the database-level foreign key constraint definition?boolean
isCollection()
Is this instance actually a CollectionPersister?boolean
isExtraLazy()
boolean
isInverse()
Is this collection "inverse", so state changes are not propagated to the database.boolean
isLazy()
Is this collection lazily initialized?abstract boolean
isManyToMany()
Is this a many-to-many association? Note that this is mainly a convenience feature as the single persister does not contain all the information needed to handle a many-to-many itself, as internally it is looked at as two many-to-ones.boolean
isMutable()
Can the elements of this collection change?boolean
isPrimitiveArray()
Is this an array of primitive values?protected boolean
isRowDeleteEnabled()
protected boolean
isRowInsertEnabled()
boolean
isSubselectLoadable()
boolean
isVersioned()
Does this collection cause version increment of the owning entity?protected void
logStaticSQL()
boolean
needsRemove()
WhetherCollectionPersister.remove(Object, SharedSessionContractImplementor)
might actually do something, or if it is definitely a no-op.void
postInstantiate()
void
processQueuedOps(PersistentCollection<?> collection, Object key, SharedSessionContractImplementor session)
Process queued operations within the PersistentCollection.void
registerAffectingFetchProfile(String fetchProfileName)
Register the profile name with the entity/collectionvoid
remove(Object id, SharedSessionContractImplementor session)
Completely remove the persistent state of the collectionString
selectFragment(String alias, String columnSuffix)
Generate a list of collection index, key and element columnsString[]
toColumns(String propertyName)
Given a property path, return the corresponding column name(s).String
toString()
Type
toType(String propertyName)
Given a component path expression, get the type of the propertyboolean
useShallowQueryCacheLayout()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.persister.collection.mutation.CollectionMutationTarget
getIdentifierTableMapping
-
Methods inherited from interface org.hibernate.persister.collection.CollectionPersister
deleteRows, insertRows, isOneToMany, recreate, updateRows
-
Methods inherited from interface org.hibernate.persister.collection.DeprecatedCollectionStuff
getRole
-
Methods inherited from interface org.hibernate.metamodel.mapping.FilterRestrictable
applyFilterRestrictions
-
Methods inherited from interface org.hibernate.persister.entity.Joinable
consumesCollectionAlias, consumesEntityAlias
-
Methods inherited from interface org.hibernate.sql.model.MutationTarget
getRolePath
-
-
-
-
Field Detail
-
qualifiedTableName
protected final String qualifiedTableName
-
hasWhere
protected final boolean hasWhere
-
sqlWhereString
protected final String sqlWhereString
-
indexContainsFormula
protected final boolean indexContainsFormula
-
elementIsPureFormula
protected final boolean elementIsPureFormula
-
keyColumnNames
protected final String[] keyColumnNames
-
indexColumnNames
protected final String[] indexColumnNames
-
indexFormulaTemplates
protected final String[] indexFormulaTemplates
-
indexFormulas
protected final String[] indexFormulas
-
indexColumnIsGettable
protected final boolean[] indexColumnIsGettable
-
indexColumnIsSettable
protected final boolean[] indexColumnIsSettable
-
elementColumnNames
protected final String[] elementColumnNames
-
elementColumnWriters
protected final String[] elementColumnWriters
-
elementColumnReaders
protected final String[] elementColumnReaders
-
elementColumnReaderTemplates
protected final String[] elementColumnReaderTemplates
-
elementFormulaTemplates
protected final String[] elementFormulaTemplates
-
elementFormulas
protected final String[] elementFormulas
-
elementColumnIsGettable
protected final boolean[] elementColumnIsGettable
-
elementColumnIsSettable
protected final boolean[] elementColumnIsSettable
-
identifierColumnName
protected final String identifierColumnName
-
isInverse
protected final boolean isInverse
-
batchSize
protected final int batchSize
-
sqlExceptionHelper
protected final SqlExceptionHelper sqlExceptionHelper
-
elementType
@Deprecated protected final Type elementType
Deprecated.
-
keyColumnAliases
@Deprecated protected final String[] keyColumnAliases
Deprecated.
-
indexColumnAliases
@Deprecated protected final String[] indexColumnAliases
Deprecated.
-
elementColumnAliases
@Deprecated protected final String[] elementColumnAliases
Deprecated.
-
-
Constructor Detail
-
AbstractCollectionPersister
@Deprecated(since="6.0") public AbstractCollectionPersister(Collection collectionBootDescriptor, @Nullable CollectionDataAccess cacheAccessStrategy, PersisterCreationContext creationContext) throws MappingException, CacheException
Deprecated.- Throws:
MappingException
CacheException
-
AbstractCollectionPersister
public AbstractCollectionPersister(Collection collectionBootDescriptor, @Nullable CollectionDataAccess cacheAccessStrategy, RuntimeModelCreationContext creationContext) throws MappingException, CacheException
- Throws:
MappingException
CacheException
-
-
Method Detail
-
getNavigableRole
public NavigableRole getNavigableRole()
Description copied from interface:CollectionPersister
The NavigableRole for this collection.- Specified by:
getNavigableRole
in interfaceCollectionPersister
- Specified by:
getNavigableRole
in interfaceMutationTarget<CollectionTableMapping>
-
getSortingComparator
public Comparator<?> getSortingComparator()
Description copied from interface:CollectionPersister
For sorted collections, the comparator to use. Non-parameterized because for SORTED_SET the elements are compared but for SORTED_MAP the keys are compared- Specified by:
getSortingComparator
in interfaceCollectionPersister
- See Also:
CollectionClassification.SORTED_MAP
,CollectionClassification.SORTED_SET
-
postInstantiate
public void postInstantiate() throws MappingException
- Specified by:
postInstantiate
in interfaceCollectionPersister
- Throws:
MappingException
-
logStaticSQL
protected void logStaticSQL()
-
initialize
public void initialize(Object key, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:CollectionPersister
Initialize the given collection with the given key- Specified by:
initialize
in interfaceCollectionPersister
- Throws:
HibernateException
-
getCollectionLoader
public CollectionLoader getCollectionLoader()
-
determineLoaderToUse
protected CollectionLoader determineLoaderToUse(Object key, SharedSessionContractImplementor session)
-
createSubSelectLoader
protected CollectionLoader createSubSelectLoader(SubselectFetch subselect, SharedSessionContractImplementor session)
-
createNamedQueryCollectionLoader
protected CollectionLoader createNamedQueryCollectionLoader(CollectionPersister persister, NamedQueryMemento namedQueryMemento)
For Hibernate Reactive
-
createSingleKeyCollectionLoader
protected CollectionLoader createSingleKeyCollectionLoader(LoadQueryInfluencers loadQueryInfluencers)
For Hibernate Reactive
-
getCacheAccessStrategy
public CollectionDataAccess getCacheAccessStrategy()
Description copied from interface:CollectionPersister
Access to the collection's cache region- Specified by:
getCacheAccessStrategy
in interfaceCollectionPersister
-
hasCache
public boolean hasCache()
Description copied from interface:CollectionPersister
Is this collection role cacheable- Specified by:
hasCache
in interfaceCollectionPersister
-
useShallowQueryCacheLayout
public boolean useShallowQueryCacheLayout()
- Specified by:
useShallowQueryCacheLayout
in interfaceCollectionPersister
-
getRowMutationOperations
protected abstract RowMutationOperations getRowMutationOperations()
-
getRemoveCoordinator
protected abstract RemoveCoordinator getRemoveCoordinator()
-
getSQLOrderByString
public String getSQLOrderByString(String alias)
Description copied from interface:QueryableCollection
Get the order by SQL- Specified by:
getSQLOrderByString
in interfaceQueryableCollection
-
getManyToManyOrderByString
public String getManyToManyOrderByString(String alias)
Description copied from interface:QueryableCollection
Get the order-by to be applied at the target table of a many to many- Specified by:
getManyToManyOrderByString
in interfaceQueryableCollection
- Parameters:
alias
- The alias for the many-to-many target table- Returns:
- appropriate order-by fragment or empty string.
-
getFetchMode
public FetchMode getFetchMode()
Description copied from interface:QueryableCollection
Should we load this collection role by outerjoining?- Specified by:
getFetchMode
in interfaceQueryableCollection
-
hasOrdering
public boolean hasOrdering()
Description copied from interface:CollectionPersister
Is this an ordered collection? (An ordered collection is ordered by the initialization operation, not by sorting that happens in memory, as in the case of a sorted collection.)- Specified by:
hasOrdering
in interfaceCollectionPersister
-
hasManyToManyOrdering
public boolean hasManyToManyOrdering()
- Specified by:
hasManyToManyOrdering
in interfaceCollectionPersister
-
hasWhere
public boolean hasWhere()
Description copied from interface:QueryableCollection
Does this collection role have a where clause filter?- Specified by:
hasWhere
in interfaceQueryableCollection
-
getElementClass
public Class<?> getElementClass()
Return the element class of an array, or null otherwise. needed by arrays- Specified by:
getElementClass
in interfaceCollectionPersister
-
decrementIndexByBase
@Deprecated(forRemoval=true) @Remove protected @Remove Object decrementIndexByBase(Object index)
Deprecated, for removal: This API element is subject to removal in a future version.No longer used.
-
isPrimitiveArray
public boolean isPrimitiveArray()
Description copied from interface:CollectionPersister
Is this an array of primitive values?- Specified by:
isPrimitiveArray
in interfaceCollectionMetadata
- Specified by:
isPrimitiveArray
in interfaceCollectionPersister
-
isArray
public boolean isArray()
Description copied from interface:CollectionPersister
Is this an array?- Specified by:
isArray
in interfaceCollectionMetadata
- Specified by:
isArray
in interfaceCollectionPersister
-
getIdentifierColumnName
public String getIdentifierColumnName()
- Specified by:
getIdentifierColumnName
in interfaceSQLLoadableCollection
-
selectFragment
public String selectFragment(String alias, String columnSuffix)
Generate a list of collection index, key and element columns- Specified by:
selectFragment
in interfaceQueryableCollection
-
generateSelectSizeString
protected String generateSelectSizeString(boolean isIntegerIndexed)
-
generateDetectRowByIndexString
protected String generateDetectRowByIndexString()
-
generateDetectRowByElementString
protected String generateDetectRowByElementString()
-
getIndexColumnNames
public String[] getIndexColumnNames()
Description copied from interface:QueryableCollection
Get the names of the collection index columns if this is an indexed collection (optional operation)- Specified by:
getIndexColumnNames
in interfaceQueryableCollection
-
getIndexFormulas
public String[] getIndexFormulas()
Description copied from interface:QueryableCollection
Get the index formulas if this is an indexed collection (optional operation)- Specified by:
getIndexFormulas
in interfaceQueryableCollection
-
getIndexColumnNames
public String[] getIndexColumnNames(String alias)
Description copied from interface:QueryableCollection
Get the names of the collection index columns if this is an indexed collection (optional operation), aliased by the given table alias- Specified by:
getIndexColumnNames
in interfaceQueryableCollection
-
getElementColumnNames
public String[] getElementColumnNames(String alias)
Description copied from interface:QueryableCollection
Get the names of the collection element columns (or the primary key columns in the case of a one-to-many association), aliased by the given table alias- Specified by:
getElementColumnNames
in interfaceQueryableCollection
-
getElementColumnNames
public String[] getElementColumnNames()
Description copied from interface:QueryableCollection
Get the names of the collection element columns (or the primary key columns in the case of a one-to-many association)- Specified by:
getElementColumnNames
in interfaceQueryableCollection
-
getKeyColumnNames
public String[] getKeyColumnNames()
Description copied from interface:Joinable
The columns to join on- Specified by:
getKeyColumnNames
in interfaceJoinable
-
hasIndex
public boolean hasIndex()
Description copied from interface:CollectionPersister
Is this an "indexed" collection? (list or map)- Specified by:
hasIndex
in interfaceCollectionMetadata
- Specified by:
hasIndex
in interfaceCollectionPersister
-
isLazy
public boolean isLazy()
Description copied from interface:CollectionPersister
Is this collection lazily initialized?- Specified by:
isLazy
in interfaceCollectionMetadata
- Specified by:
isLazy
in interfaceCollectionPersister
-
isInverse
public boolean isInverse()
Description copied from interface:CollectionPersister
Is this collection "inverse", so state changes are not propagated to the database.- Specified by:
isInverse
in interfaceCollectionPersister
-
isCascadeDeleteEnabled
public boolean isCascadeDeleteEnabled()
Description copied from interface:CollectionPersister
Is cascade delete handled by the database-level foreign key constraint definition?- Specified by:
isCascadeDeleteEnabled
in interfaceCollectionPersister
-
getTableName
public String getTableName()
Description copied from interface:Joinable
The table to join to.- Specified by:
getTableName
in interfaceJoinable
-
remove
public void remove(Object id, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:CollectionPersister
Completely remove the persistent state of the collection- Specified by:
remove
in interfaceCollectionPersister
- Throws:
HibernateException
-
isRowDeleteEnabled
protected boolean isRowDeleteEnabled()
-
needsRemove
public boolean needsRemove()
Description copied from interface:CollectionPersister
WhetherCollectionPersister.remove(Object, SharedSessionContractImplementor)
might actually do something, or if it is definitely a no-op.- Specified by:
needsRemove
in interfaceCollectionPersister
-
isRowInsertEnabled
protected boolean isRowInsertEnabled()
-
getOwnerEntityName
public String getOwnerEntityName()
-
getOwnerEntityPersister
public EntityPersister getOwnerEntityPersister()
Description copied from interface:CollectionPersister
Get the persister of the entity that "owns" this collection- Specified by:
getOwnerEntityPersister
in interfaceCollectionPersister
-
getIdentifierGenerator
@Deprecated public IdentifierGenerator getIdentifierGenerator()
Deprecated.Description copied from interface:CollectionPersister
Get the surrogate key generation strategy (optional operation)- Specified by:
getIdentifierGenerator
in interfaceCollectionPersister
-
getGenerator
public BeforeExecutionGenerator getGenerator()
Description copied from interface:CollectionPersister
Get the surrogate key generation strategy (optional operation)- Specified by:
getGenerator
in interfaceCollectionPersister
-
hasOrphanDelete
public boolean hasOrphanDelete()
Description copied from interface:CollectionPersister
Does this collection implement "orphan delete"?- Specified by:
hasOrphanDelete
in interfaceCollectionPersister
-
toType
public Type toType(String propertyName) throws QueryException
Description copied from interface:PropertyMapping
Given a component path expression, get the type of the property- Specified by:
toType
in interfacePropertyMapping
- Throws:
QueryException
-
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 interfaceRestrictable
-
applyBaseRestrictions
public void applyBaseRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String,Filter> enabledFilters, boolean onlyApplyLoadByKeyFilters, Set<String> treatAsDeclarations, SqlAstCreationState creationState)
Description copied from interface:Restrictable
Applies the base set of restrictions.- Specified by:
applyBaseRestrictions
in interfaceRestrictable
-
hasWhereRestrictions
public boolean hasWhereRestrictions()
Description copied from interface:WhereRestrictable
Does this restrictable have a where restriction?- Specified by:
hasWhereRestrictions
in interfaceWhereRestrictable
-
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 interfaceWhereRestrictable
-
applyWhereFragments
protected void applyWhereFragments(Consumer<Predicate> predicateConsumer, String alias, TableGroup tableGroup, SqlAstCreationState astCreationState)
-
applyFilterRestrictions
public void applyFilterRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String,Filter> enabledFilters, boolean onlyApplyLoadByKeyFilters, SqlAstCreationState creationState)
Description copied from interface:FilterRestrictable
Applies just theFilter
values enabled for the associated entity- Specified by:
applyFilterRestrictions
in interfaceFilterRestrictable
-
isManyToMany
public abstract boolean isManyToMany()
Description copied from interface:CollectionPersister
Is this a many-to-many association? Note that this is mainly a convenience feature as the single persister does not contain all the information needed to handle a many-to-many itself, as internally it is looked at as two many-to-ones.- Specified by:
isManyToMany
in interfaceCollectionPersister
-
applyBaseManyToManyRestrictions
public void applyBaseManyToManyRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String,Filter> enabledFilters, Set<String> treatAsDeclarations, SqlAstCreationState creationState)
- Specified by:
applyBaseManyToManyRestrictions
in interfaceCollectionPersister
-
getManyToManyFilterFragment
public String getManyToManyFilterFragment(TableGroup tableGroup, Map<String,Filter> enabledFilters)
- Specified by:
getManyToManyFilterFragment
in interfaceCollectionPersister
-
toColumns
public String[] toColumns(String propertyName) throws QueryException
Description copied from interface:PropertyMapping
Given a property path, return the corresponding column name(s).- Specified by:
toColumns
in interfacePropertyMapping
- Throws:
QueryException
-
getName
public String getName()
Description copied from interface:Joinable
An identifying name; a class name or collection role name.
-
getElementPersister
public EntityPersister getElementPersister()
Description copied from interface:QueryableCollection
Get the persister of the element class, if this is a collection of entities (optional operation). Note that for a one-to-many association, the returned persister must beOuterJoinLoadable
.- Specified by:
getElementPersister
in interfaceQueryableCollection
-
getElementPersisterInternal
protected EntityPersister getElementPersisterInternal()
-
isCollection
public boolean isCollection()
Description copied from interface:Joinable
Is this instance actually a CollectionPersister?- Specified by:
isCollection
in interfaceJoinable
-
getCollectionSpaces
public String[] getCollectionSpaces()
Description copied from interface:CollectionPersister
Get the "space" that holds the persistent state- Specified by:
getCollectionSpaces
in interfaceCollectionPersister
-
processQueuedOps
public void processQueuedOps(PersistentCollection<?> collection, Object key, SharedSessionContractImplementor session)
Description copied from interface:CollectionPersister
Process queued operations within the PersistentCollection.- Specified by:
processQueuedOps
in interfaceCollectionPersister
-
doProcessQueuedOps
protected abstract void doProcessQueuedOps(PersistentCollection<?> collection, Object key, SharedSessionContractImplementor session) throws HibernateException
- Throws:
HibernateException
-
getCollectionMetadata
@Deprecated public CollectionMetadata getCollectionMetadata()
Deprecated.Description copied from interface:CollectionPersister
Get the user-visible metadata for the collection (optional operation)- Specified by:
getCollectionMetadata
in interfaceCollectionPersister
-
getFactory
public SessionFactoryImplementor getFactory()
- Specified by:
getFactory
in interfaceCollectionPersister
-
isVersioned
public boolean isVersioned()
Description copied from interface:CollectionPersister
Does this collection cause version increment of the owning entity?- Specified by:
isVersioned
in interfaceCollectionPersister
-
getSQLExceptionHelper
protected SqlExceptionHelper getSQLExceptionHelper()
-
getCacheEntryStructure
public CacheEntryStructure getCacheEntryStructure()
Description copied from interface:CollectionPersister
Get the structure used to store data into the collection's cache region- Specified by:
getCacheEntryStructure
in interfaceCollectionPersister
-
isAffectedByEnabledFilters
public boolean isAffectedByEnabledFilters(SharedSessionContractImplementor session)
- Specified by:
isAffectedByEnabledFilters
in interfaceCollectionPersister
-
isSubselectLoadable
public boolean isSubselectLoadable()
- Specified by:
isSubselectLoadable
in interfaceCollectionPersister
-
isMutable
public boolean isMutable()
Description copied from interface:CollectionPersister
Can the elements of this collection change?- Specified by:
isMutable
in interfaceCollectionPersister
-
getCollectionPropertyColumnAliases
public String[] getCollectionPropertyColumnAliases(String propertyName, String suffix)
- Specified by:
getCollectionPropertyColumnAliases
in interfaceSQLLoadableCollection
-
initCollectionPropertyMap
public void initCollectionPropertyMap()
-
getSize
public int getSize(Object key, SharedSessionContractImplementor session)
- Specified by:
getSize
in interfaceCollectionPersister
-
indexExists
public boolean indexExists(Object key, Object index, SharedSessionContractImplementor session)
- Specified by:
indexExists
in interfaceCollectionPersister
-
elementExists
public boolean elementExists(Object key, Object element, SharedSessionContractImplementor session)
- Specified by:
elementExists
in interfaceCollectionPersister
-
getElementByIndex
public Object getElementByIndex(Object key, Object index, SharedSessionContractImplementor session, Object owner)
- Specified by:
getElementByIndex
in interfaceCollectionPersister
-
isExtraLazy
public boolean isExtraLazy()
- Specified by:
isExtraLazy
in interfaceCollectionPersister
-
getDialect
protected Dialect getDialect()
-
getBatchSize
public int getBatchSize()
- Specified by:
getBatchSize
in interfaceCollectionPersister
-
isBatchLoadable
public boolean isBatchLoadable()
- Specified by:
isBatchLoadable
in interfaceCollectionPersister
-
getMappedByProperty
public String getMappedByProperty()
- Specified by:
getMappedByProperty
in interfaceCollectionPersister
- Returns:
- the name of the property this collection is mapped by
-
getFilterAliasGenerator
public abstract FilterAliasGenerator getFilterAliasGenerator(String rootAlias)
-
getFilterAliasGenerator
public abstract FilterAliasGenerator getFilterAliasGenerator(TableGroup tableGroup)
-
injectAttributeMapping
public void injectAttributeMapping(PluralAttributeMapping attributeMapping)
Allows injection of the corresponding plural-attribute mapping.- Specified by:
injectAttributeMapping
in interfacePluralAttributeMappingImpl.Aware
- Implementation Note:
- Helps solve the chicken-egg problem of which to create first. Ultimately we could
make this work in a similar fashion to how this works in the relationship between
EmbeddableMappingType
andEmbeddableValuedModelPart
.
-
getAttributeMapping
public PluralAttributeMapping getAttributeMapping()
- Specified by:
getAttributeMapping
in interfaceCollectionPersister
-
registerAffectingFetchProfile
public void registerAffectingFetchProfile(String fetchProfileName)
Description copied from interface:FetchProfileAffectee
Register the profile name with the entity/collection- Specified by:
registerAffectingFetchProfile
in interfaceFetchProfileAffectee
-
isAffectedByEnabledFetchProfiles
public boolean isAffectedByEnabledFetchProfiles(LoadQueryInfluencers influencers)
- Specified by:
isAffectedByEnabledFetchProfiles
in interfaceCollectionPersister
-
isAffectedByEnabledFilters
public boolean isAffectedByEnabledFilters(LoadQueryInfluencers influencers)
- Specified by:
isAffectedByEnabledFilters
in interfaceCollectionPersister
-
isAffectedByEnabledFilters
public boolean isAffectedByEnabledFilters(LoadQueryInfluencers influencers, boolean onlyApplyForLoadByKeyFilters)
- Specified by:
isAffectedByEnabledFilters
in interfaceCollectionPersister
-
isAffectedByEnabledFilters
public boolean isAffectedByEnabledFilters(Set<ManagedMappingType> visitedTypes, LoadQueryInfluencers influencers, boolean onlyApplyForLoadByKeyFilters)
- Specified by:
isAffectedByEnabledFilters
in interfaceCollectionPersister
-
isAffectedByEntityGraph
public boolean isAffectedByEntityGraph(LoadQueryInfluencers influencers)
- Specified by:
isAffectedByEntityGraph
in interfaceCollectionPersister
-
getCollectionSemantics
public CollectionSemantics<?,?> getCollectionSemantics()
- Specified by:
getCollectionSemantics
in interfaceCollectionPersister
-
getTargetPart
public PluralAttributeMapping getTargetPart()
Description copied from interface:MutationTarget
The ModelPart describing the mutation target- Specified by:
getTargetPart
in interfaceCollectionMutationTarget
- Specified by:
getTargetPart
in interfaceMutationTarget<CollectionTableMapping>
-
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<CollectionTableMapping>
-
getCollectionTableMapping
public CollectionTableMapping getCollectionTableMapping()
- Specified by:
getCollectionTableMapping
in interfaceCollectionMutationTarget
-
hasPhysicalIndexColumn
public boolean hasPhysicalIndexColumn()
Description copied from interface:CollectionMutationTarget
Whether the collection has at least one physical index column- Specified by:
hasPhysicalIndexColumn
in interfaceCollectionMutationTarget
-
forEachMutableTable
public void forEachMutableTable(Consumer<CollectionTableMapping> consumer)
Description copied from interface:MutationTarget
Visit each table.- Specified by:
forEachMutableTable
in interfaceMutationTarget<CollectionTableMapping>
-
forEachMutableTableReverse
public void forEachMutableTableReverse(Consumer<CollectionTableMapping> 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<CollectionTableMapping>
-
buildDeleteAllOperation
protected JdbcMutationOperation buildDeleteAllOperation(MutatingTableReference tableReference)
-
generateDeleteAllAst
public RestrictedTableMutation<JdbcMutationOperation> generateDeleteAllAst(MutatingTableReference tableReference)
-
applyKeyRestrictions
protected void applyKeyRestrictions(MutatingTableReference tableReference, ColumnValueParameterList parameterList, List<ColumnValueBinding> restrictionBindings)
-
getCollectionType
public CollectionType getCollectionType()
Description copied from interface:CollectionPersister
Get the associatedType
- Specified by:
getCollectionType
in interfaceCollectionPersister
-
getKeyType
public Type getKeyType()
Description copied from interface:CollectionPersister
Get the "key" type (the type of the foreign key)- Specified by:
getKeyType
in interfaceCollectionMetadata
- Specified by:
getKeyType
in interfaceCollectionPersister
-
getIdentifierType
public Type getIdentifierType()
Description copied from interface:CollectionPersister
Get the type of the surrogate key- Specified by:
getIdentifierType
in interfaceCollectionPersister
-
getIndexType
public Type getIndexType()
Description copied from interface:CollectionPersister
Get the "index" type for a list or map (optional operation)- Specified by:
getIndexType
in interfaceCollectionMetadata
- Specified by:
getIndexType
in interfaceCollectionPersister
-
getElementType
public Type getElementType()
Description copied from interface:CollectionPersister
Get the "element" type- Specified by:
getElementType
in interfaceCollectionMetadata
- Specified by:
getElementType
in interfaceCollectionPersister
-
getKeyColumnAliases
public String[] getKeyColumnAliases(String suffix)
Description copied from interface:CollectionPersister
Generates the collection's key column aliases, based on the given suffix.- Specified by:
getKeyColumnAliases
in interfaceCollectionPersister
- Parameters:
suffix
- The suffix to use in the key column alias generation.- Returns:
- The key column aliases.
-
getElementColumnAliases
public String[] getElementColumnAliases(String suffix)
Description copied from interface:CollectionPersister
Generates the collection's element column aliases, based on the given suffix.- Specified by:
getElementColumnAliases
in interfaceCollectionPersister
- Parameters:
suffix
- The suffix to use in the element column alias generation.- Returns:
- The key column aliases.
-
getIndexColumnAliases
public String[] getIndexColumnAliases(String suffix)
Description copied from interface:CollectionPersister
Generates the collection's index column aliases, based on the given suffix.- Specified by:
getIndexColumnAliases
in interfaceCollectionPersister
- Parameters:
suffix
- The suffix to use in the index column alias generation.- Returns:
- The key column aliases, or null if not indexed.
-
getIdentifierColumnAlias
public String getIdentifierColumnAlias(String suffix)
Description copied from interface:CollectionPersister
Generates the collection's identifier column aliases, based on the given suffix.- Specified by:
getIdentifierColumnAlias
in interfaceCollectionPersister
- Parameters:
suffix
- The suffix to use in the key column alias generation.- Returns:
- The key column aliases.
-
-