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
,Queryable
,SelectableMappings
,TableGroupJoinProducer
,TableGroupProducer
,Fetchable
,FetchableContainer
- 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.JdbcValueConsumer
-
-
Constructor Summary
Constructors Constructor Description AnonymousTupleEmbeddableValuedModelPart(Map<String,ModelPart> modelParts, DomainType<?> domainType, String componentName, EmbeddableValuedModelPart existingModelPartContainer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState)
Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.void
applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState, BiConsumer<SqlSelection,JdbcMapping> selectionConsumer)
Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.void
breakDownJdbcValues(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.EmbeddableMappingType
createInverseMappingType(EmbeddedAttributeMapping valueMapping, TableGroupProducer declaringTableGroupProducer, SelectableMappings selectableMappings, MappingModelCreationProcess creationProcess)
TableGroup
createRootTableGroupJoin(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.TableGroupJoin
createTableGroupJoin(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.Object
disassemble(Object value, SharedSessionContractImplementor session)
EntityMappingType
findContainingEntityMapping()
ModelPart
findSubPart(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.int
forEachDisassembledJdbcValue(Object value, Clause clause, int offset, Bindable.JdbcValuesConsumer valuesConsumer, SharedSessionContractImplementor session)
int
forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)
Visit each JdbcMapping starting from the given offsetint
forEachJdbcValue(Object value, Clause clause, int offset, Bindable.JdbcValuesConsumer consumer, SharedSessionContractImplementor session)
int
forEachSelectable(int offset, SelectableConsumer consumer)
Visit each contained selectable mapping.int
forEachSelectable(SelectableConsumer consumer)
Same asSelectableMappings.forEachSelectable(int, SelectableConsumer)
, with an implicit offset of `0`Fetch
generateFetch(FetchParent fetchParent, NavigablePath fetchablePath, FetchTiming fetchTiming, boolean selected, String resultVariable, DomainResultCreationState creationState)
Generates a Fetch of this fetchableAttributeMapping
getAttributeMapping(int position)
Retrieve an attribute by its contributor positionList<AttributeMapping>
getAttributeMappings()
Get access to the attributes defined on this class and any supersString
getContainingTableExpression()
The main table expression (table name or subselect) that usually contains most of the columns to which this embedded is mapped.SqlAstJoinType
getDefaultSqlAstJoinType(TableGroup parentTableGroup)
EmbeddableMappingType
getEmbeddableTypeDescriptor()
EmbeddableValuedModelPart
getEmbeddedValueMapping()
String
getFetchableName()
The name of the fetchableJavaType<?>
getJavaType()
List<JdbcMapping>
getJdbcMappings()
The list of JDBC mappingsint
getJdbcTypeCount()
The number of JDBC mappingsFetchOptions
getMappedFetchOptions()
The configured fetch timing and styleJavaType<?>
getMappedJavaType()
NavigableRole
getNavigableRole()
int
getNumberOfAttributeMappings()
Get the number of attributes defined on this class and any supersint
getNumberOfFetchables()
The number of fetchables in the containerMappingType
getPartMappingType()
String
getPartName()
EmbeddableRepresentationStrategy
getRepresentationStrategy()
SelectableMapping
getSelectable(int columnIndex)
Get the selectable at the given positionString
getSqlAliasStem()
Get the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedObject
getValue(Object instance, int position)
Object[]
getValues(Object instance)
boolean
isCreateEmptyCompositesEnabled()
boolean
isSimpleJoinPredicate(Predicate predicate)
Returns whether the given predicate is a simple join predicate for this attribute.void
setValue(Object instance, int position, Object value)
void
setValues(Object instance, Object[] resolvedValues)
SqlTuple
toSqlExpression(TableGroup tableGroup, Clause clause, SqmToSqlAstConverter walker, SqlAstCreationState sqlAstCreationState)
void
visitAttributeMappings(Consumer<? super AttributeMapping> action)
Visit attributes defined on this class and any supersvoid
visitSubParts(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.EmbeddableValuedModelPart
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, 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.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
-
AnonymousTupleEmbeddableValuedModelPart
public AnonymousTupleEmbeddableValuedModelPart(Map<String,ModelPart> modelParts, DomainType<?> domainType, String componentName, EmbeddableValuedModelPart existingModelPartContainer)
-
-
Method Detail
-
findSubPart
public ModelPart findSubPart(String name, EntityMappingType treatTargetType)
Description copied from interface:Queryable
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.- Specified by:
findSubPart
in interfaceQueryable
-
visitSubParts
public void visitSubParts(Consumer<ModelPart> consumer, EntityMappingType treatTargetType)
Description copied from interface:Queryable
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.- Specified by:
visitSubParts
in interfaceQueryable
-
getPartMappingType
public MappingType getPartMappingType()
- Specified by:
getPartMappingType
in interfaceManagedMappingType
- Specified by:
getPartMappingType
in interfaceModelPart
-
getJavaType
public JavaType<?> getJavaType()
- Specified by:
getJavaType
in interfaceManagedMappingType
- Specified by:
getJavaType
in interfaceModelPart
-
getPartName
public String getPartName()
- Specified by:
getPartName
in interfaceModelPart
-
getJdbcTypeCount
public int getJdbcTypeCount()
Description copied from interface:Bindable
The number of JDBC mappings- Specified by:
getJdbcTypeCount
in interfaceBindable
- Specified by:
getJdbcTypeCount
in interfaceEmbeddableMappingType
- Specified by:
getJdbcTypeCount
in interfaceEmbeddableValuedModelPart
- Specified by:
getJdbcTypeCount
in interfaceJdbcMappingContainer
- Specified by:
getJdbcTypeCount
in interfaceSelectableMappings
-
getEmbeddableTypeDescriptor
public EmbeddableMappingType getEmbeddableTypeDescriptor()
- Specified by:
getEmbeddableTypeDescriptor
in interfaceEmbeddableValuedModelPart
-
getEmbeddedValueMapping
public EmbeddableValuedModelPart getEmbeddedValueMapping()
- Specified by:
getEmbeddedValueMapping
in interfaceEmbeddableMappingType
-
getRepresentationStrategy
public EmbeddableRepresentationStrategy getRepresentationStrategy()
- Specified by:
getRepresentationStrategy
in interfaceEmbeddableMappingType
-
isCreateEmptyCompositesEnabled
public boolean isCreateEmptyCompositesEnabled()
- Specified by:
isCreateEmptyCompositesEnabled
in interfaceEmbeddableMappingType
-
createInverseMappingType
public EmbeddableMappingType createInverseMappingType(EmbeddedAttributeMapping valueMapping, TableGroupProducer declaringTableGroupProducer, SelectableMappings selectableMappings, MappingModelCreationProcess creationProcess)
- Specified by:
createInverseMappingType
in interfaceEmbeddableMappingType
-
getNumberOfAttributeMappings
public int getNumberOfAttributeMappings()
Description copied from interface:ManagedMappingType
Get the number of attributes defined on this class and any supers- Specified by:
getNumberOfAttributeMappings
in interfaceManagedMappingType
-
getAttributeMapping
public AttributeMapping getAttributeMapping(int position)
Description copied from interface:ManagedMappingType
Retrieve an attribute by its contributor position- Specified by:
getAttributeMapping
in interfaceManagedMappingType
-
getAttributeMappings
public List<AttributeMapping> getAttributeMappings()
Description copied from interface:ManagedMappingType
Get access to the attributes defined on this class and any supers- Specified by:
getAttributeMappings
in interfaceManagedMappingType
-
visitAttributeMappings
public void visitAttributeMappings(Consumer<? super AttributeMapping> action)
Description copied from interface:ManagedMappingType
Visit attributes defined on this class and any supers- Specified by:
visitAttributeMappings
in interfaceManagedMappingType
-
getValues
public Object[] getValues(Object instance)
- Specified by:
getValues
in interfaceManagedMappingType
-
getValue
public Object getValue(Object instance, int position)
- Specified by:
getValue
in interfaceManagedMappingType
-
setValues
public void setValues(Object instance, Object[] resolvedValues)
- Specified by:
setValues
in interfaceManagedMappingType
-
setValue
public void setValue(Object instance, int position, Object value)
- Specified by:
setValue
in interfaceManagedMappingType
-
getSelectable
public SelectableMapping getSelectable(int columnIndex)
Description copied from interface:SelectableMappings
Get the selectable at the given position- Specified by:
getSelectable
in interfaceSelectableMappings
-
getJdbcMappings
public List<JdbcMapping> getJdbcMappings()
Description copied from interface:Bindable
The list of JDBC mappings- Specified by:
getJdbcMappings
in interfaceBindable
- Specified by:
getJdbcMappings
in interfaceEmbeddableMappingType
- Specified by:
getJdbcMappings
in interfaceEmbeddableValuedModelPart
- Specified by:
getJdbcMappings
in interfaceJdbcMappingContainer
- Specified by:
getJdbcMappings
in interfaceSelectableMappings
- See Also:
SqlTypedMapping.getJdbcMapping()
-
forEachSelectable
public int forEachSelectable(SelectableConsumer consumer)
Description copied from interface:SelectableMappings
Same asSelectableMappings.forEachSelectable(int, SelectableConsumer)
, with an implicit offset of `0`- Specified by:
forEachSelectable
in interfaceEmbeddableMappingType
- Specified by:
forEachSelectable
in interfaceModelPart
- Specified by:
forEachSelectable
in interfaceSelectableMappings
-
forEachSelectable
public int forEachSelectable(int offset, SelectableConsumer consumer)
Description copied from interface:SelectableMappings
Visit 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:
forEachSelectable
in interfaceEmbeddableMappingType
- Specified by:
forEachSelectable
in interfaceEmbeddableValuedModelPart
- Specified by:
forEachSelectable
in interfaceModelPart
- Specified by:
forEachSelectable
in interfaceSelectableMappings
- See Also:
SelectableConsumer.accept(int, SelectableMapping)
-
getContainingTableExpression
public String getContainingTableExpression()
Description copied from interface:EmbeddableValuedModelPart
The main table expression (table name or subselect) that usually contains most of the columns to which this embedded is mapped.- Specified by:
getContainingTableExpression
in interfaceEmbeddableValuedModelPart
-
toSqlExpression
public SqlTuple toSqlExpression(TableGroup tableGroup, Clause clause, SqmToSqlAstConverter walker, SqlAstCreationState sqlAstCreationState)
- Specified by:
toSqlExpression
in interfaceEmbeddableValuedModelPart
-
getMappedJavaType
public JavaType<?> getMappedJavaType()
- Specified by:
getMappedJavaType
in interfaceMappingType
-
getDefaultSqlAstJoinType
public SqlAstJoinType getDefaultSqlAstJoinType(TableGroup parentTableGroup)
- Specified by:
getDefaultSqlAstJoinType
in interfaceTableGroupJoinProducer
-
isSimpleJoinPredicate
public boolean isSimpleJoinPredicate(Predicate predicate)
Description copied from interface:TableGroupJoinProducer
Returns 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:
isSimpleJoinPredicate
in 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:TableGroupJoinProducer
Create 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 explicitON
clause, and isfalse
otherwise.- Specified by:
createTableGroupJoin
in 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:TableGroupJoinProducer
Create 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:
createRootTableGroupJoin
in interfaceTableGroupJoinProducer
-
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 generated Note 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)
-
getFetchableName
public String getFetchableName()
Description copied from interface:Fetchable
The name of the fetchable- Specified by:
getFetchableName
in interfaceFetchable
-
getMappedFetchOptions
public FetchOptions getMappedFetchOptions()
Description copied from interface:Fetchable
The configured fetch timing and style- Specified by:
getMappedFetchOptions
in interfaceFetchable
-
generateFetch
public Fetch 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 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:FetchableContainer
The number of fetchables in the container- Specified by:
getNumberOfFetchables
in interfaceFetchableContainer
-
getNavigableRole
public NavigableRole getNavigableRole()
- Specified by:
getNavigableRole
in interfaceModelPart
- See Also:
ModelPart.getPartName()
-
findContainingEntityMapping
public EntityMappingType findContainingEntityMapping()
- Specified by:
findContainingEntityMapping
in interfaceModelPart
-
createDomainResult
public <T> DomainResult<T> createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState)
Description copied from interface:ModelPart
Create a DomainResult for a specific reference to this ModelPart.- Specified by:
createDomainResult
in interfaceEmbeddableMappingType
- Specified by:
createDomainResult
in interfaceModelPart
-
applySqlSelections
public void applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState)
Description copied from interface:ModelPart
Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.- Specified by:
applySqlSelections
in interfaceEmbeddableMappingType
- Specified by:
applySqlSelections
in interfaceModelPart
-
applySqlSelections
public void applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState, BiConsumer<SqlSelection,JdbcMapping> selectionConsumer)
Description copied from interface:ModelPart
Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.- Specified by:
applySqlSelections
in interfaceEmbeddableMappingType
- Specified by:
applySqlSelections
in interfaceModelPart
-
breakDownJdbcValues
public void breakDownJdbcValues(Object domainValue, ModelPart.JdbcValueConsumer valueConsumer, SharedSessionContractImplementor session)
- Specified by:
breakDownJdbcValues
in interfaceModelPart
-
disassemble
public Object disassemble(Object value, SharedSessionContractImplementor session)
- Specified by:
disassemble
in interfaceBindable
- Specified by:
disassemble
in interfaceEmbeddableValuedModelPart
- 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:
forEachDisassembledJdbcValue
in interfaceBindable
- Specified by:
forEachDisassembledJdbcValue
in interfaceEmbeddableValuedModelPart
-
forEachJdbcValue
public int forEachJdbcValue(Object value, Clause clause, int offset, Bindable.JdbcValuesConsumer consumer, SharedSessionContractImplementor session)
- Specified by:
forEachJdbcValue
in interfaceBindable
- Specified by:
forEachJdbcValue
in interfaceEmbeddableValuedModelPart
-
forEachJdbcType
public int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)
Description copied from interface:JdbcMappingContainer
Visit each JdbcMapping starting from the given offset- Specified by:
forEachJdbcType
in interfaceEmbeddableMappingType
- Specified by:
forEachJdbcType
in interfaceEmbeddableValuedModelPart
- Specified by:
forEachJdbcType
in interfaceJdbcMappingContainer
-
-