Package org.hibernate.query.derived
Class AnonymousTupleEntityValuedModelPart
- java.lang.Object
-
- org.hibernate.query.derived.AnonymousTupleEntityValuedModelPart
-
- All Implemented Interfaces:
Loadable,Bindable,Discriminatable,EntityMappingType,EntityValuedModelPart,FilterRestrictable,JdbcMappingContainer,ManagedMappingType,MappingModelExpressible,MappingType,ModelPart,ModelPartContainer,Queryable,Restrictable,WhereRestrictable,RootTableGroupProducer,TableGroupJoinProducer,TableGroupProducer,FetchableContainer
public class AnonymousTupleEntityValuedModelPart extends Object implements EntityValuedModelPart, EntityMappingType, TableGroupJoinProducer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.Bindable
Bindable.JdbcValuesConsumer
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.EntityMappingType
EntityMappingType.ConstraintOrderedTableConsumer
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.ModelPart
ModelPart.JdbcValueConsumer
-
-
Constructor Summary
Constructors Constructor Description AnonymousTupleEntityValuedModelPart(EntityIdentifierMapping identifierMapping, DomainType<?> domainType, String componentName, EntityValuedModelPart delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState)Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.voidapplySqlSelections(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.voidbreakDownJdbcValues(Object domainValue, ModelPart.JdbcValueConsumer valueConsumer, SharedSessionContractImplementor session)<T> DomainResult<T>createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState)Create a DomainResult for a specific reference to this ModelPart.TableGroupcreateRootTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, String explicitSourceAlias, SqlAstJoinType sqlAstJoinType, boolean fetched, Consumer<Predicate> predicateConsumer, SqlAliasBaseGenerator aliasBaseGenerator, SqlExpressionResolver sqlExpressionResolver, FromClauseAccess fromClauseAccess, SqlAstCreationContext creationContext)Create a TableGroupJoin as defined for this producer, but as root TableGroup.TableGroupcreateTableGroupInternal(boolean canUseInnerJoins, NavigablePath navigablePath, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlExpressionResolver sqlExpressionResolver, SqlAstCreationContext creationContext)TableGroupJoincreateTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, String explicitSourceAlias, SqlAstJoinType requestedJoinType, boolean fetched, boolean addsPredicate, SqlAliasBaseGenerator aliasBaseGenerator, SqlExpressionResolver sqlExpressionResolver, FromClauseAccess fromClauseAccess, SqlAstCreationContext creationContext)Create a TableGroupJoin as defined for this producer The sqlAstJoinType may be null to signal that the join is for an implicit path.Objectdisassemble(Object value, SharedSessionContractImplementor session)EntityMappingTypefindContainingEntityMapping()AttributeMappingfindDeclaredAttributeMapping(String name)ModelPartfindSubPart(String name, EntityMappingType treatTargetType)For an entity, this form allows for Hibernate's "implicit treat" support - meaning it should find a sub-part whether defined on the entity, its super-type or even one of its sub-types.intforEachDisassembledJdbcValue(Object value, Clause clause, int offset, Bindable.JdbcValuesConsumer valuesConsumer, SharedSessionContractImplementor session)intforEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)Visit each JdbcMapping starting from the given offsetintforEachJdbcValue(Object value, Clause clause, int offset, Bindable.JdbcValuesConsumer consumer, SharedSessionContractImplementor session)intforEachSelectable(int offset, SelectableConsumer consumer)intforEachSelectable(SelectableConsumer consumer)AttributeMappinggetAttributeMapping(int position)Retrieve an attribute by its contributor positionList<AttributeMapping>getAttributeMappings()Get access to the attributes defined on this class and any supersCollection<AttributeMapping>getDeclaredAttributeMappings()Get access to the attributes defined on this class - do not access attributes defined on the superSqlAstJoinTypegetDefaultSqlAstJoinType(TableGroup parentTableGroup)EntityDiscriminatorMappinggetDiscriminatorMapping()ObjectgetDiscriminatorValue()EntityMappingTypegetEntityMappingType()StringgetEntityName()EntityPersistergetEntityPersister()Safety-net.EntityIdentifierMappinggetIdentifierMapping()JavaType<?>getJavaType()List<JdbcMapping>getJdbcMappings()The list of JDBC mappingsintgetJdbcTypeCount()The number of JDBC mappingsJavaType<?>getMappedJavaType()MultiNaturalIdLoader<?>getMultiNaturalIdLoader()Access to performing multi-value natural-id database selection.NaturalIdLoader<?>getNaturalIdLoader()Access to performing natural-id database selection.NaturalIdMappinggetNaturalIdMapping()NavigableRolegetNavigableRole()intgetNumberOfAttributeMappings()Get the number of attributes defined on this class and any supersintgetNumberOfFetchables()The number of fetchables in the containerMappingTypegetPartMappingType()StringgetPartName()EntityRowIdMappinggetRowIdMapping()StringgetSqlAliasStem()Get the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedStringgetSubclassForDiscriminatorValue(Object value)ObjectgetValue(Object instance, int position)Object[]getValues(Object instance)EntityVersionMappinggetVersionMapping()booleanisSimpleJoinPredicate(Predicate predicate)Returns whether the given predicate is a simple join predicate for this attribute.voidsetValue(Object instance, int position, Object value)voidsetValues(Object instance, Object[] resolvedValues)voidvisitAttributeMappings(Consumer<? super AttributeMapping> action)Visit attributes defined on this class and any supersvoidvisitConstraintOrderedTables(EntityMappingType.ConstraintOrderedTableConsumer consumer)voidvisitDeclaredAttributeMappings(Consumer<? super AttributeMapping> action)Visit attributes defined on this class - do not visit attributes defined on the supervoidvisitQuerySpaces(Consumer<String> querySpaceConsumer)voidvisitSubParts(Consumer<ModelPart> consumer, EntityMappingType treatTargetType)LikeQueryable.findSubPart(java.lang.String, org.hibernate.metamodel.mapping.EntityMappingType), this form visits all parts defined on the entity, its super-types and its sub-types.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.metamodel.mapping.Bindable
forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue
-
Methods inherited from interface org.hibernate.metamodel.mapping.EntityMappingType
applyBaseRestrictions, applyDiscriminator, applyFilterRestrictions, applyWhereRestrictions, createPrimaryTableReference, createRootTableGroup, createRootTableGroup, createTableReferenceJoin, extractConcreteTypeStateValues, findSubPart, getContributor, getFetchable, getNumberOfDeclaredAttributeMappings, getRepresentationStrategy, getRootEntityDescriptor, getRootPathName, getSqmMultiTableInsertStrategy, getSqmMultiTableMutationStrategy, getSubclassEntityNames, getSubclassId, getSubMappingTypes, getSuperMappingType, hasSubclasses, isAbstract, isAffectedByEnabledFetchProfiles, isAffectedByEnabledFilters, isAffectedByEntityGraph, isTypeOrSuperType, isTypeOrSuperType, pruneForSubclasses, visitAttributeMappings, visitSubTypeAttributeMappings, visitSuperTypeAttributeMappings
-
Methods inherited from interface org.hibernate.sql.results.graph.FetchableContainer
getKeyFetchable, getNumberOfKeyFetchables, visitFetchables, visitFetchables, visitFetchables, visitKeyFetchables, visitKeyFetchables, visitKeyFetchables
-
Methods inherited from interface org.hibernate.metamodel.mapping.ManagedMappingType
findAttributeMapping, forEachAttributeMapping
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
areEqual, asAttributeMapping
-
Methods inherited from interface org.hibernate.metamodel.mapping.Queryable
findByPath, findSubTypesSubPart, resolveSubPart
-
Methods inherited from interface org.hibernate.sql.ast.tree.from.TableGroupJoinProducer
createRootTableGroupJoin, createTableGroupJoin
-
Methods inherited from interface org.hibernate.sql.ast.tree.from.TableGroupProducer
containsTableReference
-
-
-
-
Constructor Detail
-
AnonymousTupleEntityValuedModelPart
public AnonymousTupleEntityValuedModelPart(EntityIdentifierMapping identifierMapping, DomainType<?> domainType, String componentName, EntityValuedModelPart delegate)
-
-
Method Detail
-
findSubPart
public ModelPart findSubPart(String name, EntityMappingType treatTargetType)
Description copied from interface:QueryableFor an entity, this form allows for Hibernate's "implicit treat" support - meaning it should find a sub-part whether defined on the entity, its super-type or even one of its sub-types.- Specified by:
findSubPartin interfaceEntityMappingType- Specified by:
findSubPartin interfaceEntityValuedModelPart- Specified by:
findSubPartin interfaceQueryable
-
visitSubParts
public void visitSubParts(Consumer<ModelPart> consumer, EntityMappingType treatTargetType)
Description copied from interface:QueryableLikeQueryable.findSubPart(java.lang.String, org.hibernate.metamodel.mapping.EntityMappingType), this form visits all parts defined on the entity, its super-types and its sub-types.- Specified by:
visitSubPartsin interfaceEntityMappingType- Specified by:
visitSubPartsin interfaceEntityValuedModelPart- Specified by:
visitSubPartsin interfaceQueryable
-
getPartMappingType
public MappingType getPartMappingType()
- Specified by:
getPartMappingTypein interfaceEntityMappingType- Specified by:
getPartMappingTypein interfaceManagedMappingType- Specified by:
getPartMappingTypein interfaceModelPart
-
getJavaType
public JavaType<?> getJavaType()
- Specified by:
getJavaTypein interfaceEntityMappingType- Specified by:
getJavaTypein interfaceManagedMappingType- Specified by:
getJavaTypein interfaceModelPart
-
getPartName
public String getPartName()
- Specified by:
getPartNamein interfaceEntityMappingType- Specified by:
getPartNamein interfaceModelPart
-
getJdbcTypeCount
public int getJdbcTypeCount()
Description copied from interface:BindableThe number of JDBC mappings- Specified by:
getJdbcTypeCountin interfaceBindable- Specified by:
getJdbcTypeCountin interfaceEntityMappingType- Specified by:
getJdbcTypeCountin interfaceEntityValuedModelPart- Specified by:
getJdbcTypeCountin interfaceJdbcMappingContainer
-
getNumberOfAttributeMappings
public int getNumberOfAttributeMappings()
Description copied from interface:ManagedMappingTypeGet the number of attributes defined on this class and any supers- Specified by:
getNumberOfAttributeMappingsin interfaceEntityMappingType- Specified by:
getNumberOfAttributeMappingsin interfaceManagedMappingType
-
getAttributeMapping
public AttributeMapping getAttributeMapping(int position)
Description copied from interface:ManagedMappingTypeRetrieve an attribute by its contributor position- Specified by:
getAttributeMappingin interfaceEntityMappingType- Specified by:
getAttributeMappingin interfaceManagedMappingType
-
getAttributeMappings
public List<AttributeMapping> getAttributeMappings()
Description copied from interface:ManagedMappingTypeGet access to the attributes defined on this class and any supers- Specified by:
getAttributeMappingsin interfaceEntityMappingType- Specified by:
getAttributeMappingsin interfaceManagedMappingType
-
visitAttributeMappings
public void visitAttributeMappings(Consumer<? super AttributeMapping> action)
Description copied from interface:ManagedMappingTypeVisit attributes defined on this class and any supers- Specified by:
visitAttributeMappingsin interfaceEntityMappingType- Specified by:
visitAttributeMappingsin interfaceManagedMappingType
-
getValues
public Object[] getValues(Object instance)
- Specified by:
getValuesin interfaceManagedMappingType
-
getValue
public Object getValue(Object instance, int position)
- Specified by:
getValuein interfaceManagedMappingType
-
setValues
public void setValues(Object instance, Object[] resolvedValues)
- Specified by:
setValuesin interfaceManagedMappingType
-
setValue
public void setValue(Object instance, int position, Object value)
- Specified by:
setValuein interfaceManagedMappingType
-
getJdbcMappings
public List<JdbcMapping> getJdbcMappings()
Description copied from interface:BindableThe list of JDBC mappings- Specified by:
getJdbcMappingsin interfaceBindable- Specified by:
getJdbcMappingsin interfaceJdbcMappingContainer
-
forEachSelectable
public int forEachSelectable(SelectableConsumer consumer)
- Specified by:
forEachSelectablein interfaceModelPart
-
forEachSelectable
public int forEachSelectable(int offset, SelectableConsumer consumer)- Specified by:
forEachSelectablein interfaceModelPart
-
getMappedJavaType
public JavaType<?> getMappedJavaType()
- Specified by:
getMappedJavaTypein interfaceEntityMappingType- Specified by:
getMappedJavaTypein interfaceMappingType
-
createTableGroupJoin
public TableGroupJoin createTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, String explicitSourceAlias, SqlAstJoinType requestedJoinType, boolean fetched, boolean addsPredicate, SqlAliasBaseGenerator aliasBaseGenerator, SqlExpressionResolver sqlExpressionResolver, FromClauseAccess fromClauseAccess, SqlAstCreationContext creationContext)
Description copied from interface:TableGroupJoinProducerCreate a TableGroupJoin as defined for this producer The sqlAstJoinType may be null to signal that the join is for an implicit path. When addsPredicate istrue, the SQM join for the attribute contains an explicitONclause, and isfalseotherwise.- Specified by:
createTableGroupJoinin interfaceTableGroupJoinProducer
-
createTableGroupInternal
public TableGroup createTableGroupInternal(boolean canUseInnerJoins, NavigablePath navigablePath, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlExpressionResolver sqlExpressionResolver, SqlAstCreationContext creationContext)
-
createRootTableGroupJoin
public TableGroup createRootTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, String explicitSourceAlias, SqlAstJoinType sqlAstJoinType, boolean fetched, Consumer<Predicate> predicateConsumer, SqlAliasBaseGenerator aliasBaseGenerator, SqlExpressionResolver sqlExpressionResolver, FromClauseAccess fromClauseAccess, SqlAstCreationContext creationContext)
Description copied from interface:TableGroupJoinProducerCreate a TableGroupJoin as defined for this producer, but as root TableGroup. The main purpose of this is for correlating an association in a subquery i.e. `... alias where exists (select 1 from SomeEntity e where alias.association.attr = 1)`. The sqlAstJoinType may be null to signal that the join is for an implicit path.- Specified by:
createRootTableGroupJoinin interfaceTableGroupJoinProducer
-
getSqlAliasStem
public String getSqlAliasStem()
Description copied from interface:TableGroupProducerGet the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generated Note that this is a metadata-ive value. It is only ever used internal to the producer producing its TableGroup.- Specified by:
getSqlAliasStemin interfaceEntityMappingType- Specified by:
getSqlAliasStemin interfaceTableGroupProducer- See Also:
SqlAliasBaseManager.createSqlAliasBase(java.lang.String)
-
getNumberOfFetchables
public int getNumberOfFetchables()
Description copied from interface:FetchableContainerThe number of fetchables in the container- Specified by:
getNumberOfFetchablesin interfaceEntityMappingType- Specified by:
getNumberOfFetchablesin interfaceFetchableContainer
-
getNavigableRole
public NavigableRole getNavigableRole()
- Specified by:
getNavigableRolein interfaceModelPart- See Also:
ModelPart.getPartName()
-
findContainingEntityMapping
public EntityMappingType findContainingEntityMapping()
- Specified by:
findContainingEntityMappingin interfaceEntityMappingType- Specified by:
findContainingEntityMappingin interfaceModelPart
-
createDomainResult
public <T> DomainResult<T> createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState)
Description copied from interface:ModelPartCreate a DomainResult for a specific reference to this ModelPart.- Specified by:
createDomainResultin interfaceEntityMappingType- Specified by:
createDomainResultin interfaceEntityValuedModelPart- Specified by:
createDomainResultin interfaceModelPart
-
applySqlSelections
public void applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState)
Description copied from interface:ModelPartApply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.- Specified by:
applySqlSelectionsin interfaceEntityMappingType- Specified by:
applySqlSelectionsin interfaceEntityValuedModelPart- Specified by:
applySqlSelectionsin interfaceModelPart
-
applySqlSelections
public void applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState, BiConsumer<SqlSelection,JdbcMapping> selectionConsumer)
Description copied from interface:ModelPartApply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.- Specified by:
applySqlSelectionsin interfaceEntityMappingType- Specified by:
applySqlSelectionsin interfaceEntityValuedModelPart- Specified by:
applySqlSelectionsin interfaceModelPart
-
breakDownJdbcValues
public void breakDownJdbcValues(Object domainValue, ModelPart.JdbcValueConsumer valueConsumer, SharedSessionContractImplementor session)
- Specified by:
breakDownJdbcValuesin interfaceModelPart
-
disassemble
public Object disassemble(Object value, SharedSessionContractImplementor session)
- Specified by:
disassemblein interfaceBindable- Specified by:
disassemblein interfaceEntityMappingType- Specified by:
disassemblein interfaceEntityValuedModelPart- See Also:
As an example, consider the following domain model: ````
-
forEachDisassembledJdbcValue
public int forEachDisassembledJdbcValue(Object value, Clause clause, int offset, Bindable.JdbcValuesConsumer valuesConsumer, SharedSessionContractImplementor session)
- Specified by:
forEachDisassembledJdbcValuein interfaceBindable- Specified by:
forEachDisassembledJdbcValuein interfaceEntityMappingType- Specified by:
forEachDisassembledJdbcValuein interfaceEntityValuedModelPart
-
forEachJdbcValue
public int forEachJdbcValue(Object value, Clause clause, int offset, Bindable.JdbcValuesConsumer consumer, SharedSessionContractImplementor session)
- Specified by:
forEachJdbcValuein interfaceBindable- Specified by:
forEachJdbcValuein interfaceEntityMappingType- Specified by:
forEachJdbcValuein interfaceEntityValuedModelPart
-
forEachJdbcType
public int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)Description copied from interface:JdbcMappingContainerVisit each JdbcMapping starting from the given offset- Specified by:
forEachJdbcTypein interfaceEntityMappingType- Specified by:
forEachJdbcTypein interfaceEntityValuedModelPart- Specified by:
forEachJdbcTypein interfaceJdbcMappingContainer
-
getEntityPersister
public EntityPersister getEntityPersister()
Description copied from interface:EntityMappingTypeSafety-net. todo (6.0) : do we really need to expose?- Specified by:
getEntityPersisterin interfaceEntityMappingType
-
getEntityName
public String getEntityName()
- Specified by:
getEntityNamein interfaceEntityMappingType
-
visitQuerySpaces
public void visitQuerySpaces(Consumer<String> querySpaceConsumer)
- Specified by:
visitQuerySpacesin interfaceEntityMappingType
-
findDeclaredAttributeMapping
public AttributeMapping findDeclaredAttributeMapping(String name)
- Specified by:
findDeclaredAttributeMappingin interfaceEntityMappingType
-
getDeclaredAttributeMappings
public Collection<AttributeMapping> getDeclaredAttributeMappings()
Description copied from interface:EntityMappingTypeGet access to the attributes defined on this class - do not access attributes defined on the super- Specified by:
getDeclaredAttributeMappingsin interfaceEntityMappingType
-
visitDeclaredAttributeMappings
public void visitDeclaredAttributeMappings(Consumer<? super AttributeMapping> action)
Description copied from interface:EntityMappingTypeVisit attributes defined on this class - do not visit attributes defined on the super- Specified by:
visitDeclaredAttributeMappingsin interfaceEntityMappingType
-
getIdentifierMapping
public EntityIdentifierMapping getIdentifierMapping()
- Specified by:
getIdentifierMappingin interfaceEntityMappingType
-
getDiscriminatorMapping
public EntityDiscriminatorMapping getDiscriminatorMapping()
- Specified by:
getDiscriminatorMappingin interfaceEntityMappingType
-
getDiscriminatorValue
public Object getDiscriminatorValue()
- Specified by:
getDiscriminatorValuein interfaceEntityMappingType
-
getSubclassForDiscriminatorValue
public String getSubclassForDiscriminatorValue(Object value)
- Specified by:
getSubclassForDiscriminatorValuein interfaceEntityMappingType
-
getVersionMapping
public EntityVersionMapping getVersionMapping()
- Specified by:
getVersionMappingin interfaceEntityMappingType
-
getNaturalIdMapping
public NaturalIdMapping getNaturalIdMapping()
- Specified by:
getNaturalIdMappingin interfaceEntityMappingType
-
getRowIdMapping
public EntityRowIdMapping getRowIdMapping()
- Specified by:
getRowIdMappingin interfaceEntityMappingType
-
visitConstraintOrderedTables
public void visitConstraintOrderedTables(EntityMappingType.ConstraintOrderedTableConsumer consumer)
- Specified by:
visitConstraintOrderedTablesin interfaceEntityMappingType
-
getNaturalIdLoader
public NaturalIdLoader<?> getNaturalIdLoader()
Description copied from interface:EntityMappingTypeAccess to performing natural-id database selection. This is per-entity in the hierarchy- Specified by:
getNaturalIdLoaderin interfaceEntityMappingType
-
getMultiNaturalIdLoader
public MultiNaturalIdLoader<?> getMultiNaturalIdLoader()
Description copied from interface:EntityMappingTypeAccess to performing multi-value natural-id database selection. This is per-entity in the hierarchy- Specified by:
getMultiNaturalIdLoaderin interfaceEntityMappingType
-
getEntityMappingType
public EntityMappingType getEntityMappingType()
- Specified by:
getEntityMappingTypein interfaceEntityValuedModelPart
-
getDefaultSqlAstJoinType
public SqlAstJoinType getDefaultSqlAstJoinType(TableGroup parentTableGroup)
- Specified by:
getDefaultSqlAstJoinTypein interfaceTableGroupJoinProducer
-
isSimpleJoinPredicate
public boolean isSimpleJoinPredicate(Predicate predicate)
Description copied from interface:TableGroupJoinProducerReturns whether the given predicate is a simple join predicate for this attribute. This is useful to understand if a predicate has additional conjunctions other than the FK related predicate.- Specified by:
isSimpleJoinPredicatein interfaceTableGroupJoinProducer
-
-