Top Description Fields Constructors Methods
org.hibernate.query.derived

public Class AnonymousTupleTableGroupProducer

extends Object
implements TableGroupProducer, MappingType
Class Inheritance
All Implemented Interfaces
org.hibernate.metamodel.mapping.MappingType, org.hibernate.sql.ast.tree.from.TableGroupProducer, org.hibernate.metamodel.mapping.ModelPartContainer, org.hibernate.metamodel.mapping.ModelPart, org.hibernate.metamodel.mapping.MappingModelExpressible, org.hibernate.metamodel.mapping.Bindable, org.hibernate.metamodel.mapping.JdbcMappingContainer
Known Direct Subclasses
org.hibernate.query.derived.CteTupleTableGroupProducer
Annotations
@Incubating
Imports
java.util.HashSet, .List, .Map, .Set, java.util.function.BiConsumer, .Consumer, org.hibernate.Incubating, org.hibernate.cache.MutableCacheKeyBuilder, org.hibernate.engine.spi.SharedSessionContractImplementor, org.hibernate.internal.util.IndexedConsumer, org.hibernate.internal.util.collections.CollectionHelper, org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping, .CompositeIdentifierMapping, .EmbeddableValuedModelPart, .EntityIdentifierMapping, .EntityMappingType, .EntityValuedModelPart, .JdbcMapping, .ManagedMappingType, .MappingType, .ModelPart, .NonAggregatedIdentifierMapping, .SelectableConsumer, org.hibernate.metamodel.mapping.internal.SingleAttributeIdentifierMapping, .ToOneAttributeMapping, org.hibernate.metamodel.model.domain.DomainType, .EntityDomainType, .ManagedDomainType, .NavigableRole, org.hibernate.query.sqm.SqmExpressible, org.hibernate.query.sqm.tree.domain.SqmPath, org.hibernate.query.sqm.tree.select.SqmSelectableNode, org.hibernate.spi.NavigablePath, org.hibernate.sql.ast.spi.FromClauseAccess, .SqlSelection, org.hibernate.sql.ast.tree.from.LazyTableGroup, .PluralTableGroup, .TableGroup, .TableGroupProducer, org.hibernate.sql.results.graph.DomainResult, .DomainResultCreationState, org.hibernate.type.descriptor.java.JavaType, jakarta.persistence.metamodel.Attribute

The table group producer for an anonymous tuple type. Model part names are determined based on the tuple type component names. The kind and type of the model parts is based on the type of the underlying selection.
Author
Christian Beikov

Field Summary

Modifier and TypeField and Description
private final String
private final Set<String>
private final JavaType<?>
private final Map<String, ModelPart>

Constructor Summary

AccessConstructor and Description
public
AnonymousTupleTableGroupProducer(AnonymousTupleType<?> tupleType, String aliasStem, List<SqlSelection> sqlSelections, FromClauseAccess fromClauseAccess)

Method Summary

Modifier and TypeMethod and Description
public void
addToCacheKey(MutableCacheKeyBuilder
the MutableCacheKey used to add the disassembled value and the hashCode
cacheKey
,
Object
the value to disassemble
value
,
SharedSessionContractImplementor
the SharedSessionContractImplementor
session
)

Implements org.hibernate.metamodel.mapping.Bindable.addToCacheKey.

Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.
public void
applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.ModelPart.applySqlSelections.

Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.
public void
applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState, BiConsumer<SqlSelection, JdbcMapping> selectionConsumer)

Implements org.hibernate.metamodel.mapping.ModelPart.applySqlSelections.

Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.
public <X, Y> int
breakDownJdbcValues(Object domainValue, int offset, X x, Y y, ModelPart.JdbcValueBiConsumer<X, Y> valueConsumer, SharedSessionContractImplementor session)

Implements org.hibernate.metamodel.mapping.ModelPart.breakDownJdbcValues.

Breaks down the domain value to its constituent JDBC values.
public <T> DomainResult<T>
createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.ModelPart.createDomainResult.

Create a DomainResult for a specific reference to this ModelPart.
public static ModelPart
createModelPart(MappingType mappingType, SqmExpressible<?> sqmExpressible, DomainType<?> domainType, List<SqlSelection> sqlSelections, int selectionIndex, String selectionExpression, String partName, ModelPart existingModelPart, Set<String> compatibleTableExpressions, int fetchableIndex)

public Object
disassemble(Object value, SharedSessionContractImplementor session)

Implements org.hibernate.metamodel.mapping.Bindable.disassemble.

Breaks down a value of J into its simple pieces.
public EntityMappingType
public ModelPart
public <X, Y> int
public int
forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)

Implements org.hibernate.metamodel.mapping.JdbcMappingContainer.forEachJdbcType.

Visit each JdbcMapping starting from the given offset
public int
forEachSelectable(int offset, SelectableConsumer consumer)

Overrides default org.hibernate.metamodel.mapping.ModelPart.forEachSelectable.

Visits each selectable mapping with the selectable index offset by the given value.
public void
public Set<String>
public JavaType<?>
getJavaType()

Implements org.hibernate.metamodel.mapping.ModelPart.getJavaType.

The Java type for this part.
public JdbcMapping
public JavaType<?>
private ModelPart
public Map<String, ModelPart>
public NavigableRole
public MappingType
public String
getPartName()

Implements org.hibernate.metamodel.mapping.ModelPart.getPartName.

The local part name, which is generally the unqualified role name
public String
getSqlAliasStem()

Implements org.hibernate.sql.ast.tree.from.TableGroupProducer.getSqlAliasStem.

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.

public boolean
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aliasStemback to summary
private final String aliasStem
compatibleTableExpressionsback to summary
private final Set<String> compatibleTableExpressions
javaTypeDescriptorback to summary
private final JavaType<?> javaTypeDescriptor
modelPartsback to summary
private final Map<String, ModelPart> modelParts

Constructor Detail

AnonymousTupleTableGroupProducerback to summary
public AnonymousTupleTableGroupProducer(AnonymousTupleType<?> tupleType, String aliasStem, List<SqlSelection> sqlSelections, FromClauseAccess fromClauseAccess)

Method Detail

addToCacheKeyback to summary
public void addToCacheKey(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session)

Implements org.hibernate.metamodel.mapping.Bindable.addToCacheKey.

Doc from org.hibernate.metamodel.mapping.Bindable.addToCacheKey.

Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.

Parameters
cacheKey:MutableCacheKeyBuilder

the MutableCacheKey used to add the disassembled value and the hashCode

value:Object

the value to disassemble

session:SharedSessionContractImplementor

the SharedSessionContractImplementor

Annotations
@Override
applySqlSelectionsback to summary
public void applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.ModelPart.applySqlSelections.

Doc from org.hibernate.metamodel.mapping.ModelPart.applySqlSelections.

Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.

Annotations
@Override
applySqlSelectionsback to summary
public void applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState, BiConsumer<SqlSelection, JdbcMapping> selectionConsumer)

Implements org.hibernate.metamodel.mapping.ModelPart.applySqlSelections.

Doc from org.hibernate.metamodel.mapping.ModelPart.applySqlSelections.

Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.

Annotations
@Override
breakDownJdbcValuesback to summary
public <X, Y> int breakDownJdbcValues(Object domainValue, int offset, X x, Y y, ModelPart.JdbcValueBiConsumer<X, Y> valueConsumer, SharedSessionContractImplementor session)

Implements org.hibernate.metamodel.mapping.ModelPart.breakDownJdbcValues.

Doc from org.hibernate.metamodel.mapping.ModelPart.breakDownJdbcValues.

Breaks down the domain value to its constituent JDBC values. Think of it as breaking the multi-dimensional array into a visitable flat array. Additionally, it passes through the values X and Y to the consumer. Returns the amount of jdbc types that have been visited.

Annotations
@Override
createDomainResultback to summary
public <T> DomainResult<T> createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.ModelPart.createDomainResult.

Doc from org.hibernate.metamodel.mapping.ModelPart.createDomainResult.

Create a DomainResult for a specific reference to this ModelPart.

Annotations
@Override
createModelPartback to summary
public static ModelPart createModelPart(MappingType mappingType, SqmExpressible<?> sqmExpressible, DomainType<?> domainType, List<SqlSelection> sqlSelections, int selectionIndex, String selectionExpression, String partName, ModelPart existingModelPart, Set<String> compatibleTableExpressions, int fetchableIndex)
disassembleback to summary
public Object disassemble(Object value, SharedSessionContractImplementor session)

Implements org.hibernate.metamodel.mapping.Bindable.disassemble.

Doc from org.hibernate.metamodel.mapping.Bindable.disassemble.

Breaks down a value of J 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 the Bindable for the Person entity to disassemble. Given a Person 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.

Annotations
@Override
findContainingEntityMappingback to summary
public EntityMappingType findContainingEntityMapping()

Implements org.hibernate.metamodel.mapping.ModelPart.findContainingEntityMapping.

Annotations
@Override
findSubPartback to summary
public ModelPart findSubPart(String name, EntityMappingType treatTargetType)

Implements org.hibernate.metamodel.mapping.ModelPartContainer.findSubPart.

Annotations
@Override
forEachDisassembledJdbcValueback to summary
public <X, Y> int forEachDisassembledJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X, Y> valuesConsumer, SharedSessionContractImplementor session)

Implements org.hibernate.metamodel.mapping.Bindable.forEachDisassembledJdbcValue.

Doc from org.hibernate.metamodel.mapping.Bindable.forEachDisassembledJdbcValue.

Like forEachDisassembledJdbcValue(Object, Object, Object, JdbcValuesBiConsumer, SharedSessionContractImplementor), but additionally receives an offset by which the selectionIndex is incremented when calling JdbcValuesBiConsumer#consume(int, Object, Object, Object, JdbcMapping).

Annotations
@Override
forEachJdbcTypeback to summary
public int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)

Implements org.hibernate.metamodel.mapping.JdbcMappingContainer.forEachJdbcType.

Doc from org.hibernate.metamodel.mapping.JdbcMappingContainer.forEachJdbcType.

Visit each JdbcMapping starting from the given offset

Annotations
@Override
forEachSelectableback to summary
public int forEachSelectable(int offset, SelectableConsumer consumer)

Overrides default org.hibernate.metamodel.mapping.ModelPart.forEachSelectable.

Doc from org.hibernate.metamodel.mapping.ModelPart.forEachSelectable.

Visits each selectable mapping with the selectable index offset by the given value. Returns the amount of jdbc types that have been visited.

Annotations
@Override
forEachSubPartback to summary
public void forEachSubPart(IndexedConsumer<ModelPart> consumer, EntityMappingType treatTarget)

Implements org.hibernate.metamodel.mapping.ModelPartContainer.forEachSubPart.

Annotations
@Override
getCompatibleTableExpressionsback to summary
public Set<String> getCompatibleTableExpressions()
getJavaTypeback to summary
public JavaType<?> getJavaType()

Implements org.hibernate.metamodel.mapping.ModelPart.getJavaType.

Doc from org.hibernate.metamodel.mapping.ModelPart.getJavaType.

The Java type for this part. Generally equivalent to MappingType#getMappedJavaType() relative to getPartMappingType()

Annotations
@Override
getJdbcMappingback to summary
public JdbcMapping getJdbcMapping(int index)

Implements org.hibernate.metamodel.mapping.JdbcMappingContainer.getJdbcMapping.

Annotations
@Override
getMappedJavaTypeback to summary
public JavaType<?> getMappedJavaType()

Implements org.hibernate.metamodel.mapping.MappingType.getMappedJavaType.

Doc from org.hibernate.metamodel.mapping.MappingType.getMappedJavaType.

The descriptor descriptor for the mapped Java type

Annotations
@Override
getModelPartback to summary
private ModelPart getModelPart(TableGroup tableGroup)
getModelPartsback to summary
public Map<String, ModelPart> getModelParts()
getNavigableRoleback to summary
public NavigableRole getNavigableRole()

Implements org.hibernate.metamodel.mapping.ModelPart.getNavigableRole.

Annotations
@Override
getPartMappingTypeback to summary
public MappingType getPartMappingType()

Implements org.hibernate.metamodel.mapping.ModelPart.getPartMappingType.

Doc from org.hibernate.metamodel.mapping.ModelPart.getPartMappingType.

The type for this part.

Annotations
@Override
getPartNameback to summary
public String getPartName()

Implements org.hibernate.metamodel.mapping.ModelPart.getPartName.

Doc from org.hibernate.metamodel.mapping.ModelPart.getPartName.

The local part name, which is generally the unqualified role name

Annotations
@Override
getSqlAliasStemback to summary
public String getSqlAliasStem()

Implements org.hibernate.sql.ast.tree.from.TableGroupProducer.getSqlAliasStem.

Doc from org.hibernate.sql.ast.tree.from.TableGroupProducer.getSqlAliasStem.

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.

Annotations
@Override
hasPartitionedSelectionMappingback to summary
public boolean hasPartitionedSelectionMapping()

Implements org.hibernate.metamodel.mapping.ModelPart.hasPartitionedSelectionMapping.

Annotations
@Override
visitSubPartsback to summary
public void visitSubParts(Consumer<ModelPart> consumer, EntityMappingType treatTargetType)

Implements org.hibernate.metamodel.mapping.ModelPartContainer.visitSubParts.

Annotations
@Override