Class AbstractEntityCollectionPart
- java.lang.Object
-
- org.hibernate.metamodel.mapping.internal.AbstractEntityCollectionPart
-
- All Implemented Interfaces:
Bindable
,CollectionPart
,EntityValuedModelPart
,EntityCollectionPart
,JdbcMappingContainer
,MappingModelExpressible
,ModelPart
,ModelPartContainer
,SelectableMappings
,ValuedModelPart
,ValueMapping
,TableGroupProducer
,EntityValuedFetchable
,Fetchable
,FetchableContainer
,FetchOptions
,FetchStyleAccess
,FetchTimingAccess
,JavaTypedExpressible
- Direct Known Subclasses:
ManyToManyCollectionPart
,OneToManyCollectionPart
public abstract class AbstractEntityCollectionPart extends Object implements EntityCollectionPart, FetchOptions, TableGroupProducer
Base support for EntityCollectionPart implementations
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.Bindable
Bindable.JdbcValuesBiConsumer<X,Y>, Bindable.JdbcValuesConsumer
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.CollectionPart
CollectionPart.Nature
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.internal.EntityCollectionPart
EntityCollectionPart.Cardinality
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.ModelPart
ModelPart.JdbcValueBiConsumer<X,Y>, ModelPart.JdbcValueConsumer
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<String>
targetKeyPropertyNames
-
Constructor Summary
Constructors Modifier Constructor Description AbstractEntityCollectionPart(CollectionPart.Nature nature, Collection collectionBootDescriptor, CollectionPersister collectionDescriptor, EntityMappingType associatedEntityTypeDescriptor, NotFoundAction notFoundAction, MappingModelCreationProcess creationProcess)
protected
AbstractEntityCollectionPart(AbstractEntityCollectionPart original)
For Hibernate Reactive
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected EagerCollectionFetch
buildEagerCollectionFetch(NavigablePath fetchedPath, PluralAttributeMapping fetchedAttribute, TableGroup collectionTableGroup, FetchParent fetchParent, DomainResultCreationState creationState)
For Hibernate Reactiveprotected EntityFetch
buildEntityFetchJoined(FetchParent fetchParent, AbstractEntityCollectionPart abstractEntityCollectionPart, TableGroup partTableGroup, NavigablePath fetchablePath, DomainResultCreationState creationState)
For Hibernate Reactiveboolean
containsTableReference(String tableExpression)
<T> DomainResult<T>
createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState)
Create a DomainResult for a specific reference to this ModelPart.TableGroup
createTableGroupInternal(boolean canUseInnerJoins, NavigablePath navigablePath, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlAstCreationState creationState)
Object
disassemble(Object value, SharedSessionContractImplementor session)
Breaks down a value ofJ
into its simple pieces.EntityMappingType
findContainingEntityMapping()
EntityFetch
generateFetch(FetchParent fetchParent, NavigablePath fetchablePath, FetchTiming fetchTiming, boolean selected, String resultVariable, DomainResultCreationState creationState)
Generates a Fetch of this fetchableEntityMappingType
getAssociatedEntityMappingType()
PluralAttributeMapping
getCollectionAttribute()
CollectionPersister
getCollectionDescriptor()
int
getFetchableKey()
The key that identifies this Fetchable within aFetchableContainer
.String
getFetchableName()
The name of the fetchable.FetchOptions
getMappedFetchOptions()
The configured fetch timing and styleEntityMappingType
getMappedType()
Descriptor for the type of this mappingCollectionPart.Nature
getNature()
NavigableRole
getNavigableRole()
NotFoundAction
getNotFoundAction()
int
getNumberOfFetchables()
The number of fetchables in the containerString
getSqlAliasStem()
Get the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedFetchStyle
getStyle()
FetchTiming
getTiming()
boolean
incrementFetchDepth()
Should this Fetchable affect the fetch depth? E.g., composites would generally not increment the fetch depth.boolean
isOptional()
boolean
isUnwrapProxy()
protected abstract AssociationKey
resolveFetchAssociationKey()
String
toString()
-
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
-
Methods inherited from interface org.hibernate.metamodel.mapping.CollectionPart
getInclusionCheckPart, getPartName
-
Methods inherited from interface org.hibernate.metamodel.mapping.internal.EntityCollectionPart
addToCacheKey, finishInitialization, getCardinality, getEntityMappingType, getExpressibleJavaType, getJavaType, getJdbcTypeCount, getPartMappingType
-
Methods inherited from interface org.hibernate.metamodel.mapping.EntityValuedModelPart
applySqlSelections, applySqlSelections, findSubPart, findSubPart, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachSubPart, visitSubParts
-
Methods inherited from interface org.hibernate.sql.results.graph.Fetchable
asAttributeMapping, isSelectable, resolveCircularFetch
-
Methods inherited from interface org.hibernate.sql.results.graph.FetchableContainer
getFetchable, getKeyFetchable, getNumberOfFetchableKeys, getNumberOfKeyFetchables, getSelectableIndex, visitFetchables, visitFetchables, visitFetchables, visitKeyFetchables, visitKeyFetchables, visitKeyFetchables
-
Methods inherited from interface org.hibernate.metamodel.mapping.JdbcMappingContainer
getJdbcMapping
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
areEqual, asBasicValuedModelPart, asEntityMappingType, breakDownJdbcValues, breakDownJdbcValues, decompose, decompose, hasPartitionedSelectionMapping, isEntityIdentifierMapping, isVirtual
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPartContainer
findByPath, findByPath, forEachSubPart
-
Methods inherited from interface org.hibernate.metamodel.mapping.SelectableMappings
getSelectable
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValuedModelPart
forEachInsertable, forEachNonFormula, forEachSelectable, forEachSelectable, forEachUpdatable, getContainingTableExpression, getSingleJdbcMapping
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValueMapping
treatAs
-
-
-
-
Constructor Detail
-
AbstractEntityCollectionPart
public AbstractEntityCollectionPart(CollectionPart.Nature nature, Collection collectionBootDescriptor, CollectionPersister collectionDescriptor, EntityMappingType associatedEntityTypeDescriptor, NotFoundAction notFoundAction, MappingModelCreationProcess creationProcess)
-
AbstractEntityCollectionPart
protected AbstractEntityCollectionPart(AbstractEntityCollectionPart original)
For Hibernate Reactive
-
-
Method Detail
-
getCollectionDescriptor
public CollectionPersister getCollectionDescriptor()
-
getMappedType
public EntityMappingType getMappedType()
Description copied from interface:ValueMapping
Descriptor for the type of this mapping- Specified by:
getMappedType
in interfaceValueMapping
-
getNavigableRole
public NavigableRole getNavigableRole()
- Specified by:
getNavigableRole
in interfaceModelPart
- See Also:
ModelPart.getPartName()
-
getNature
public CollectionPart.Nature getNature()
- Specified by:
getNature
in interfaceCollectionPart
-
getCollectionAttribute
public PluralAttributeMapping getCollectionAttribute()
- Specified by:
getCollectionAttribute
in interfaceCollectionPart
-
getFetchableName
public String getFetchableName()
Description copied from interface:Fetchable
The name of the fetchable. This is the part's "local name".- Specified by:
getFetchableName
in interfaceEntityCollectionPart
- Specified by:
getFetchableName
in interfaceFetchable
- See Also:
ModelPart.getNavigableRole()
,NavigableRole.getLocalName()
-
getFetchableKey
public int getFetchableKey()
Description copied from interface:Fetchable
The key that identifies this Fetchable within aFetchableContainer
. If this Fetchable is part ofFetchableContainer.visitFetchables(IndexedConsumer, EntityMappingType)
, the values is guaranteed to be between 0 (inclusive) andFetchableContainer.getNumberOfFetchableKeys()
(exclusive). Other Fetchable objects may have a special negative value.The main intent of this key is to index e.g.
Fetch
objects in an array.- Specified by:
getFetchableKey
in interfaceFetchable
-
getAssociatedEntityMappingType
public EntityMappingType getAssociatedEntityMappingType()
- Specified by:
getAssociatedEntityMappingType
in interfaceEntityCollectionPart
-
getNotFoundAction
public NotFoundAction getNotFoundAction()
- Specified by:
getNotFoundAction
in interfaceEntityCollectionPart
-
getMappedFetchOptions
public FetchOptions getMappedFetchOptions()
Description copied from interface:Fetchable
The configured fetch timing and style- Specified by:
getMappedFetchOptions
in interfaceFetchable
-
getStyle
public FetchStyle getStyle()
- Specified by:
getStyle
in interfaceFetchStyleAccess
-
getTiming
public FetchTiming getTiming()
- Specified by:
getTiming
in interfaceFetchTimingAccess
-
incrementFetchDepth
public boolean incrementFetchDepth()
Description copied from interface:Fetchable
Should this Fetchable affect the fetch depth? E.g., composites would generally not increment the fetch depth.- Specified by:
incrementFetchDepth
in interfaceFetchable
- See Also:
FetchSettings.MAX_FETCH_DEPTH
-
isOptional
public boolean isOptional()
- Specified by:
isOptional
in interfaceEntityValuedFetchable
-
isUnwrapProxy
public boolean isUnwrapProxy()
- Specified by:
isUnwrapProxy
in interfaceEntityValuedFetchable
-
findContainingEntityMapping
public EntityMappingType findContainingEntityMapping()
- Specified by:
findContainingEntityMapping
in interfaceModelPart
-
getNumberOfFetchables
public int getNumberOfFetchables()
Description copied from interface:FetchableContainer
The number of fetchables in the container- Specified by:
getNumberOfFetchables
in interfaceFetchableContainer
-
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
-
disassemble
public Object disassemble(Object value, SharedSessionContractImplementor session)
Description copied from interface:Bindable
Breaks down a value ofJ
into its simple pieces. E.g., an embedded value gets broken down into an array of its attribute state; a basic value converts to itself; etc.Generally speaking, this is the form in which entity state is kept relative to a Session via
EntityEntry
.@Entity class Person { @Id Integer id; @Embedded Name name; int age; } @Embeddable class Name { String familiarName; String familyName; }
At the top level, we would want to disassemble a
Person
value, so we'd ask theBindable
for thePerson
entity to disassemble. Given aPerson
value:Person( id=1, name=Name( 'Steve', 'Ebersole' ), 28 )
this disassemble would result in a multidimensional array:
[ ["Steve", "Ebersole"], 28 ]
Note that the identifier is not part of this disassembled state. Note also how the embedded value results in a sub-array.
- Specified by:
disassemble
in interfaceBindable
- Specified by:
disassemble
in interfaceEntityValuedModelPart
- See Also:
EntityEntry
-
generateFetch
public EntityFetch generateFetch(FetchParent fetchParent, NavigablePath fetchablePath, FetchTiming fetchTiming, boolean selected, String resultVariable, DomainResultCreationState creationState)
Description copied from interface:Fetchable
Generates a Fetch of this fetchable- Specified by:
generateFetch
in interfaceEntityValuedFetchable
- Specified by:
generateFetch
in interfaceFetchable
- Parameters:
fetchParent
- The parent of the Fetch we are generatingfetchablePath
- The overall path within the graphfetchTiming
- The requested fetch timing
-
buildEagerCollectionFetch
protected EagerCollectionFetch buildEagerCollectionFetch(NavigablePath fetchedPath, PluralAttributeMapping fetchedAttribute, TableGroup collectionTableGroup, FetchParent fetchParent, DomainResultCreationState creationState)
For Hibernate Reactive
-
buildEntityFetchJoined
protected EntityFetch buildEntityFetchJoined(FetchParent fetchParent, AbstractEntityCollectionPart abstractEntityCollectionPart, TableGroup partTableGroup, NavigablePath fetchablePath, DomainResultCreationState creationState)
For Hibernate Reactive
-
resolveFetchAssociationKey
protected abstract AssociationKey resolveFetchAssociationKey()
-
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 interfaceTableGroupProducer
- See Also:
SqlAliasBaseManager.createSqlAliasBase(java.lang.String)
-
containsTableReference
public boolean containsTableReference(String tableExpression)
- Specified by:
containsTableReference
in interfaceTableGroupProducer
-
createTableGroupInternal
public TableGroup createTableGroupInternal(boolean canUseInnerJoins, NavigablePath navigablePath, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlAstCreationState creationState)
-
-