Package org.hibernate.query.derived
Class AnonymousTupleEmbeddableValuedModelPart
- java.lang.Object
-
- org.hibernate.query.derived.AnonymousTupleEmbeddableValuedModelPart
-
- All Implemented Interfaces:
Bindable,EmbeddableMappingType,EmbeddableValuedModelPart,JdbcMappingContainer,ManagedMappingType,MappingModelExpressible,MappingType,ModelPart,ModelPartContainer,SelectableMappings,ValuedModelPart,ValueMapping,TableGroupJoinProducer,TableGroupProducer,Fetchable,FetchableContainer,JavaTypedExpressible
- Direct Known Subclasses:
AnonymousTupleEmbeddedEntityIdentifierMapping,AnonymousTupleNonAggregatedEntityIdentifierMapping
public class AnonymousTupleEmbeddableValuedModelPart extends Object implements EmbeddableValuedModelPart, EmbeddableMappingType
-
-
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.ModelPart
ModelPart.IndexedJdbcValueConsumer, ModelPart.JdbcValueConsumer
-
-
Constructor Summary
Constructors Constructor Description AnonymousTupleEmbeddableValuedModelPart(Map<String,ModelPart> modelParts, DomainType<?> domainType, String componentName, EmbeddableValuedModelPart existingModelPartContainer, int fetchableIndex)
-
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.EmbeddableMappingTypecreateInverseMappingType(EmbeddedAttributeMapping valueMapping, TableGroupProducer declaringTableGroupProducer, SelectableMappings selectableMappings, MappingModelCreationProcess creationProcess)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.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()ModelPartfindSubPart(String name, EntityMappingType treatTargetType)voidforEachAttributeMapping(Consumer<? super AttributeMapping> action)Visit attributes defined on this class and any supersintforEachDisassembledJdbcValue(Object value, int offset, Bindable.JdbcValuesConsumer valuesConsumer, SharedSessionContractImplementor session)intforEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)Visit each JdbcMapping starting from the given offsetintforEachJdbcValue(Object value, int offset, Bindable.JdbcValuesConsumer consumer, SharedSessionContractImplementor session)intforEachSelectable(int offset, SelectableConsumer consumer)Visit each contained selectable mapping.intforEachSelectable(SelectableConsumer consumer)Same asSelectableMappings.forEachSelectable(int, SelectableConsumer), with an implicit offset of `0`FetchgenerateFetch(FetchParent fetchParent, NavigablePath fetchablePath, FetchTiming fetchTiming, boolean selected, String resultVariable, DomainResultCreationState creationState)Generates a Fetch of this fetchableAttributeMappinggetAttributeMapping(int position)Retrieve an attribute by its contributor positionAttributeMappingsListgetAttributeMappings()Get access to the attributes defined on this class and any supersStringgetContainingTableExpression()The table which contains the columns mapped by this valueSqlAstJoinTypegetDefaultSqlAstJoinType(TableGroup parentTableGroup)EmbeddableMappingTypegetEmbeddableTypeDescriptor()EmbeddableValuedModelPartgetEmbeddedValueMapping()intgetFetchableKey()The key that identifies this Fetchable within aFetchableContainer.StringgetFetchableName()The name of the fetchable.JavaType<?>getJavaType()The Java type for this part.List<JdbcMapping>getJdbcMappings()The list of JDBC mappingsintgetJdbcTypeCount()The number of JDBC mappingsFetchOptionsgetMappedFetchOptions()The configured fetch timing and styleJavaType<?>getMappedJavaType()The descriptor descriptor for the mapped Java typeNavigableRolegetNavigableRole()intgetNumberOfAttributeMappings()Get the number of attributes defined on this class and any supersintgetNumberOfFetchables()The number of fetchables in the containerMappingTypegetPartMappingType()The type for this part.StringgetPartName()The local part name, which is generally the unqualified role nameEmbeddableRepresentationStrategygetRepresentationStrategy()SelectableMappinggetSelectable(int columnIndex)Get the selectable at the given positionStringgetSqlAliasStem()Get the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedObjectgetValue(Object instance, int position)Extract a specific attribute value from the entity instance, by positionObject[]getValues(Object instance)Extract the individual attribute values from the entity instancebooleanhasPartitionedSelectionMapping()booleanisCreateEmptyCompositesEnabled()booleanisSimpleJoinPredicate(Predicate predicate)Returns whether the given predicate is a simple join predicate for this attribute.voidsetValue(Object instance, int position, Object value)Inject a specific attribute value into the entity instance, by positionvoidsetValues(Object instance, Object[] resolvedValues)Inject the attribute values into the entity instanceSqlTupletoSqlExpression(TableGroup tableGroup, Clause clause, SqmToSqlAstConverter walker, SqlAstCreationState sqlAstCreationState)voidvisitSubParts(Consumer<ModelPart> consumer, EntityMappingType treatTargetType)-
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.EmbeddableMappingType
anyRequiresAggregateColumnWriter, compare, forEachInsertable, forEachUpdatable, getAggregateMapping, getJdbcValueCount, getJdbcValueSelectable, getSelectableIndex, requiresAggregateColumnWriter, shouldBindAggregateMapping, shouldMutateAggregateMapping, shouldSelectAggregateMapping
-
Methods inherited from interface org.hibernate.metamodel.mapping.EmbeddableValuedModelPart
forEachSubPart, getMappedType, getParentInjectionAttributePropertyAccess
-
Methods inherited from interface org.hibernate.sql.results.graph.Fetchable
asAttributeMapping, incrementFetchDepth, resolveCircularFetch
-
Methods inherited from interface org.hibernate.sql.results.graph.FetchableContainer
getFetchable, getKeyFetchable, getNumberOfFetchableKeys, 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, decompose, isVirtual
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPartContainer
findByPath, forEachSubPart
-
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
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValuedModelPart
forEachInsertable, forEachUpdatable
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValueMapping
getExpressibleJavaType, treatAs
-
-
-
-
Constructor Detail
-
AnonymousTupleEmbeddableValuedModelPart
public AnonymousTupleEmbeddableValuedModelPart(Map<String,ModelPart> modelParts, DomainType<?> domainType, String componentName, EmbeddableValuedModelPart existingModelPartContainer, int fetchableIndex)
-
-
Method Detail
-
findSubPart
public ModelPart findSubPart(String name, EntityMappingType treatTargetType)
- Specified by:
findSubPartin interfaceEmbeddableValuedModelPart- Specified by:
findSubPartin interfaceModelPartContainer
-
visitSubParts
public void visitSubParts(Consumer<ModelPart> consumer, EntityMappingType treatTargetType)
- Specified by:
visitSubPartsin interfaceEmbeddableValuedModelPart- Specified by:
visitSubPartsin interfaceModelPartContainer
-
getPartMappingType
public MappingType getPartMappingType()
Description copied from interface:ModelPartThe type for this part.- Specified by:
getPartMappingTypein interfaceManagedMappingType- Specified by:
getPartMappingTypein interfaceModelPart
-
getJavaType
public JavaType<?> getJavaType()
Description copied from interface:ModelPartThe Java type for this part. Generally equivalent toMappingType.getMappedJavaType()relative toModelPart.getPartMappingType()- Specified by:
getJavaTypein interfaceManagedMappingType- Specified by:
getJavaTypein interfaceModelPart
-
getPartName
public String getPartName()
Description copied from interface:ModelPartThe local part name, which is generally the unqualified role name- Specified by:
getPartNamein interfaceModelPart
-
getJdbcTypeCount
public int getJdbcTypeCount()
Description copied from interface:BindableThe number of JDBC mappings- Specified by:
getJdbcTypeCountin interfaceBindable- Specified by:
getJdbcTypeCountin interfaceEmbeddableMappingType- Specified by:
getJdbcTypeCountin interfaceEmbeddableValuedModelPart- Specified by:
getJdbcTypeCountin interfaceJdbcMappingContainer- Specified by:
getJdbcTypeCountin interfaceSelectableMappings- Specified by:
getJdbcTypeCountin interfaceValuedModelPart
-
getEmbeddableTypeDescriptor
public EmbeddableMappingType getEmbeddableTypeDescriptor()
- Specified by:
getEmbeddableTypeDescriptorin interfaceEmbeddableValuedModelPart
-
getEmbeddedValueMapping
public EmbeddableValuedModelPart getEmbeddedValueMapping()
- Specified by:
getEmbeddedValueMappingin interfaceEmbeddableMappingType
-
getRepresentationStrategy
public EmbeddableRepresentationStrategy getRepresentationStrategy()
- Specified by:
getRepresentationStrategyin interfaceEmbeddableMappingType
-
isCreateEmptyCompositesEnabled
public boolean isCreateEmptyCompositesEnabled()
- Specified by:
isCreateEmptyCompositesEnabledin interfaceEmbeddableMappingType
-
createInverseMappingType
public EmbeddableMappingType createInverseMappingType(EmbeddedAttributeMapping valueMapping, TableGroupProducer declaringTableGroupProducer, SelectableMappings selectableMappings, MappingModelCreationProcess creationProcess)
- Specified by:
createInverseMappingTypein interfaceEmbeddableMappingType
-
getNumberOfAttributeMappings
public int getNumberOfAttributeMappings()
Description copied from interface:ManagedMappingTypeGet the number of attributes defined on this class and any supers- Specified by:
getNumberOfAttributeMappingsin interfaceManagedMappingType
-
getAttributeMapping
public AttributeMapping getAttributeMapping(int position)
Description copied from interface:ManagedMappingTypeRetrieve an attribute by its contributor position- Specified by:
getAttributeMappingin interfaceManagedMappingType
-
getAttributeMappings
public AttributeMappingsList getAttributeMappings()
Description copied from interface:ManagedMappingTypeGet access to the attributes defined on this class and any supers- Specified by:
getAttributeMappingsin interfaceManagedMappingType
-
forEachAttributeMapping
public void forEachAttributeMapping(Consumer<? super AttributeMapping> action)
Description copied from interface:ManagedMappingTypeVisit attributes defined on this class and any supers- Specified by:
forEachAttributeMappingin interfaceManagedMappingType
-
getValues
public Object[] getValues(Object instance)
Description copied from interface:ManagedMappingTypeExtract the individual attribute values from the entity instance- Specified by:
getValuesin interfaceManagedMappingType
-
getValue
public Object getValue(Object instance, int position)
Description copied from interface:ManagedMappingTypeExtract a specific attribute value from the entity instance, by position- Specified by:
getValuein interfaceManagedMappingType
-
setValues
public void setValues(Object instance, Object[] resolvedValues)
Description copied from interface:ManagedMappingTypeInject the attribute values into the entity instance- Specified by:
setValuesin interfaceManagedMappingType
-
setValue
public void setValue(Object instance, int position, Object value)
Description copied from interface:ManagedMappingTypeInject a specific attribute value into the entity instance, by position- Specified by:
setValuein interfaceManagedMappingType
-
getSelectable
public SelectableMapping getSelectable(int columnIndex)
Description copied from interface:SelectableMappingsGet the selectable at the given position- Specified by:
getSelectablein interfaceEmbeddableValuedModelPart- Specified by:
getSelectablein interfaceSelectableMappings
-
getJdbcMappings
public List<JdbcMapping> getJdbcMappings()
Description copied from interface:BindableThe list of JDBC mappings- Specified by:
getJdbcMappingsin interfaceBindable- Specified by:
getJdbcMappingsin interfaceEmbeddableMappingType- Specified by:
getJdbcMappingsin interfaceEmbeddableValuedModelPart- Specified by:
getJdbcMappingsin interfaceJdbcMappingContainer- Specified by:
getJdbcMappingsin interfaceSelectableMappings- Specified by:
getJdbcMappingsin interfaceValuedModelPart- See Also:
SqlTypedMapping.getJdbcMapping()
-
forEachSelectable
public int forEachSelectable(SelectableConsumer consumer)
Description copied from interface:SelectableMappingsSame asSelectableMappings.forEachSelectable(int, SelectableConsumer), with an implicit offset of `0`- Specified by:
forEachSelectablein interfaceEmbeddableMappingType- Specified by:
forEachSelectablein interfaceModelPart- Specified by:
forEachSelectablein interfaceSelectableMappings- Specified by:
forEachSelectablein interfaceValuedModelPart
-
forEachSelectable
public int forEachSelectable(int offset, SelectableConsumer consumer)Description copied from interface:SelectableMappingsVisit each contained selectable mapping. As the selectables are iterated, we call `SelectionConsumer` passing along `offset` + our current iteration index. The return is the number of selectables we directly contain- Specified by:
forEachSelectablein interfaceEmbeddableMappingType- Specified by:
forEachSelectablein interfaceEmbeddableValuedModelPart- Specified by:
forEachSelectablein interfaceModelPart- Specified by:
forEachSelectablein interfaceSelectableMappings- Specified by:
forEachSelectablein interfaceValuedModelPart- See Also:
SelectableConsumer.accept(int, SelectableMapping)
-
getContainingTableExpression
public String getContainingTableExpression()
Description copied from interface:ValuedModelPartThe table which contains the columns mapped by this value- Specified by:
getContainingTableExpressionin interfaceValuedModelPart
-
toSqlExpression
public SqlTuple toSqlExpression(TableGroup tableGroup, Clause clause, SqmToSqlAstConverter walker, SqlAstCreationState sqlAstCreationState)
- Specified by:
toSqlExpressionin interfaceEmbeddableValuedModelPart
-
getMappedJavaType
public JavaType<?> getMappedJavaType()
Description copied from interface:MappingTypeThe descriptor descriptor for the mapped Java type- Specified by:
getMappedJavaTypein interfaceMappingType
-
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
-
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
-
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 generatedNote that this is a metadata-ive value. It is only ever used internal to the producer producing its TableGroup.
- Specified by:
getSqlAliasStemin interfaceTableGroupProducer- See Also:
SqlAliasBaseManager.createSqlAliasBase(java.lang.String)
-
getFetchableName
public String getFetchableName()
Description copied from interface:FetchableThe name of the fetchable. This is the part's "local name".- Specified by:
getFetchableNamein interfaceFetchable- See Also:
ModelPart.getNavigableRole(),NavigableRole.getLocalName()
-
getFetchableKey
public int getFetchableKey()
Description copied from interface:FetchableThe 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.
Fetchobjects in an array.- Specified by:
getFetchableKeyin interfaceFetchable
-
getMappedFetchOptions
public FetchOptions getMappedFetchOptions()
Description copied from interface:FetchableThe configured fetch timing and style- Specified by:
getMappedFetchOptionsin interfaceFetchable
-
generateFetch
public Fetch generateFetch(FetchParent fetchParent, NavigablePath fetchablePath, FetchTiming fetchTiming, boolean selected, String resultVariable, DomainResultCreationState creationState)
Description copied from interface:FetchableGenerates a Fetch of this fetchable- Specified by:
generateFetchin interfaceFetchable- Parameters:
fetchParent- The parent of the Fetch we are generatingfetchablePath- The overall path within the graphfetchTiming- The requested fetch timing
-
getNumberOfFetchables
public int getNumberOfFetchables()
Description copied from interface:FetchableContainerThe number of fetchables in the container- Specified by:
getNumberOfFetchablesin interfaceFetchableContainer
-
getNavigableRole
public NavigableRole getNavigableRole()
- Specified by:
getNavigableRolein interfaceModelPart- See Also:
ModelPart.getPartName()
-
findContainingEntityMapping
public EntityMappingType findContainingEntityMapping()
- Specified by:
findContainingEntityMappingin interfaceModelPart
-
hasPartitionedSelectionMapping
public boolean hasPartitionedSelectionMapping()
- Specified by:
hasPartitionedSelectionMappingin interfaceManagedMappingType- Specified by:
hasPartitionedSelectionMappingin 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 interfaceEmbeddableMappingType- 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 interfaceEmbeddableMappingType- 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 interfaceEmbeddableMappingType- 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 interfaceEmbeddableValuedModelPart- See Also:
As an example, consider the following domain model: ````
-
forEachDisassembledJdbcValue
public int forEachDisassembledJdbcValue(Object value, int offset, Bindable.JdbcValuesConsumer valuesConsumer, SharedSessionContractImplementor session)
- Specified by:
forEachDisassembledJdbcValuein interfaceBindable- Specified by:
forEachDisassembledJdbcValuein interfaceEmbeddableValuedModelPart
-
forEachJdbcValue
public int forEachJdbcValue(Object value, int offset, Bindable.JdbcValuesConsumer consumer, SharedSessionContractImplementor session)
- Specified by:
forEachJdbcValuein interfaceBindable- Specified by:
forEachJdbcValuein interfaceEmbeddableValuedModelPart
-
forEachJdbcType
public int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)Description copied from interface:JdbcMappingContainerVisit each JdbcMapping starting from the given offset- Specified by:
forEachJdbcTypein interfaceEmbeddableMappingType- Specified by:
forEachJdbcTypein interfaceEmbeddableValuedModelPart- Specified by:
forEachJdbcTypein interfaceJdbcMappingContainer
-
-