Top Fields Constructors Methods
org.hibernate.metamodel.mapping.internal

public Class EmbeddedForeignKeyDescriptor

extends Object
implements ForeignKeyDescriptor
Class Inheritance
All Implemented Interfaces
org.hibernate.metamodel.mapping.ForeignKeyDescriptor, org.hibernate.metamodel.mapping.ValuedModelPart, org.hibernate.metamodel.mapping.SelectableMappings, org.hibernate.metamodel.mapping.ValueMapping, org.hibernate.type.descriptor.java.JavaTypedExpressible, org.hibernate.metamodel.mapping.MappingModelExpressible, org.hibernate.metamodel.mapping.Bindable, org.hibernate.metamodel.mapping.JdbcMappingContainer, org.hibernate.metamodel.mapping.ModelPart, org.hibernate.metamodel.mapping.VirtualModelPart
Imports
java.util.ArrayList, .List, java.util.function.BiConsumer, .IntFunction, org.hibernate.cache.MutableCacheKeyBuilder, org.hibernate.engine.spi.SharedSessionContractImplementor, org.hibernate.internal.util.IndexedConsumer, .MutableInteger, org.hibernate.metamodel.mapping.AssociationKey, .AttributeMapping, .CompositeIdentifierMapping, .EmbeddableMappingType, .EmbeddableValuedModelPart, .EntityMappingType, .ForeignKeyDescriptor, .JdbcMapping, .ManagedMappingType, .MappingType, .ModelPart, .SelectableConsumer, .SelectableMapping, .SelectableMappings, .ValuedModelPart, org.hibernate.metamodel.model.domain.NavigableRole, org.hibernate.query.sqm.ComparisonOperator, org.hibernate.spi.NavigablePath, org.hibernate.sql.ast.SqlAstJoinType, org.hibernate.sql.ast.spi.SqlAstCreationState, .SqlSelection, org.hibernate.sql.ast.tree.expression.ColumnReference, .Expression, org.hibernate.sql.ast.tree.from.OneToManyTableGroup, .TableGroup, .TableGroupJoin, .TableGroupProducer, .TableReference, .VirtualTableGroup, org.hibernate.sql.ast.tree.predicate.ComparisonPredicate, .Junction, .Predicate, org.hibernate.sql.results.graph.DomainResult, .DomainResultCreationState, .FetchParent, org.hibernate.sql.results.graph.embeddable.internal.EmbeddableForeignKeyResultImpl, org.hibernate.type.descriptor.java.JavaType

Author
Andrea Boriero

Field Summary

Modifier and TypeField and Description
private final AssociationKey
private final boolean
private final SelectableMappings
private final EmbeddedForeignKeyDescriptorSide
private final String
private final SelectableMappings
private final EmbeddedForeignKeyDescriptorSide
private final String

Constructor Summary

AccessConstructor and Description
public
EmbeddedForeignKeyDescriptor(String keyTable, SelectableMappings keySelectableMappings, EmbeddableValuedModelPart keyMappingType, String targetTable, SelectableMappings targetSelectableMappings, EmbeddableValuedModelPart targetMappingType, boolean hasConstraint, MappingModelCreationProcess creationProcess)

public
EmbeddedForeignKeyDescriptor(EmbeddableValuedModelPart keyMappingType, EmbeddableValuedModelPart targetMappingType, String keyTable, SelectableMappings keySelectableMappings, String targetTable, SelectableMappings targetSelectableMappings, boolean hasConstraint, MappingModelCreationProcess creationProcess)

private
EmbeddedForeignKeyDescriptor(EmbeddedForeignKeyDescriptor original, String keyTable, ManagedMappingType keyDeclaringType, TableGroupProducer keyDeclaringTableGroupProducer, SelectableMappings keySelectableMappings, MappingModelCreationProcess creationProcess)

private

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, org.hibernate.type.descriptor.java.JavaTypedExpressible.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 int
public <T> DomainResult<T>
createDomainResult(NavigablePath navigablePath, TableGroup targetTableGroup, String resultVariable, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.createDomainResult.

Create a DomainResult for the referring-side of the fk The table group must be the one containing the target.
private <T> DomainResult<T>
createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, ForeignKeyDescriptor.Nature nature, FetchParent fetchParent, DomainResultCreationState creationState)

public DomainResult<?>
createKeyDomainResult(NavigablePath navigablePath, TableGroup targetTableGroup, FetchParent fetchParent, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.createKeyDomainResult.

Create a DomainResult for the referring-side of the fk The table group must be the one containing the target.
public DomainResult<?>
createKeyDomainResult(NavigablePath navigablePath, TableGroup targetTableGroup, ForeignKeyDescriptor.Nature fromSide, FetchParent fetchParent, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.createKeyDomainResult.

Create a DomainResult for the referring-side of the fk The table group must be the one containing the target.
public DomainResult<?>
createTargetDomainResult(NavigablePath navigablePath, TableGroup targetTableGroup, FetchParent fetchParent, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.createTargetDomainResult.

Create a DomainResult for the target-side of the fk The table group must be the one containing the target
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 <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 Predicate
public Predicate
public AssociationKey
public Object
public JavaType<?>
getJavaType()

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

The Java type for this part.
public JdbcMapping
public EmbeddableValuedModelPart
public ForeignKeyDescriptor.Side
public String
public MappingType
getMappedType()

Implements org.hibernate.metamodel.mapping.ValueMapping.getMappedType.

Descriptor for the type of this mapping
public NavigableRole
public MappingType
public SelectableMapping
getSelectable(int columnIndex)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.getSelectable.

Get the selectable at the given position
public EmbeddableValuedModelPart
public ForeignKeyDescriptor.Side
public String
private static TableGroup
public boolean
public boolean
public boolean
public boolean
public boolean
private boolean
public int
public int
public ForeignKeyDescriptor
withKeySelectionMapping(ManagedMappingType declaringType, TableGroupProducer declaringTableGroupProducer, IntFunction<SelectableMapping> selectableMappingAccess, MappingModelCreationProcess creationProcess)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.withKeySelectionMapping.

Return a copy of this foreign key descriptor with the selectable mappings as provided by the given accessor.
public ForeignKeyDescriptor
withTargetPart(ValuedModelPart targetPart)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.withTargetPart.

Return a copy of this foreign key descriptor with the target part as given by the argument.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

associationKeyback to summary
private final AssociationKey associationKey
hasConstraintback to summary
private final boolean hasConstraint
keySelectableMappingsback to summary
private final SelectableMappings keySelectableMappings
keySideback to summary
private final EmbeddedForeignKeyDescriptorSide keySide
keyTableback to summary
private final String keyTable
targetSelectableMappingsback to summary
private final SelectableMappings targetSelectableMappings
targetSideback to summary
private final EmbeddedForeignKeyDescriptorSide targetSide
targetTableback to summary
private final String targetTable

Constructor Detail

EmbeddedForeignKeyDescriptorback to summary
public EmbeddedForeignKeyDescriptor(String keyTable, SelectableMappings keySelectableMappings, EmbeddableValuedModelPart keyMappingType, String targetTable, SelectableMappings targetSelectableMappings, EmbeddableValuedModelPart targetMappingType, boolean hasConstraint, MappingModelCreationProcess creationProcess)
EmbeddedForeignKeyDescriptorback to summary
public EmbeddedForeignKeyDescriptor(EmbeddableValuedModelPart keyMappingType, EmbeddableValuedModelPart targetMappingType, String keyTable, SelectableMappings keySelectableMappings, String targetTable, SelectableMappings targetSelectableMappings, boolean hasConstraint, MappingModelCreationProcess creationProcess)
EmbeddedForeignKeyDescriptorback to summary
private EmbeddedForeignKeyDescriptor(EmbeddedForeignKeyDescriptor original, String keyTable, ManagedMappingType keyDeclaringType, TableGroupProducer keyDeclaringTableGroupProducer, SelectableMappings keySelectableMappings, MappingModelCreationProcess creationProcess)
EmbeddedForeignKeyDescriptorback to summary
private EmbeddedForeignKeyDescriptor(EmbeddedForeignKeyDescriptor original, EmbeddableValuedModelPart targetPart)

Method Detail

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

Implements org.hibernate.metamodel.mapping.Bindable.addToCacheKey, org.hibernate.type.descriptor.java.JavaTypedExpressible.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
compareback to summary
public int compare(Object key1, Object key2)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.compare.

Doc from org.hibernate.metamodel.mapping.ForeignKeyDescriptor.compare.

Compare the 2 values

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

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.createDomainResult.

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

Create a DomainResult for the referring-side of the fk The table group must be the one containing the target.

Annotations
@Override
createDomainResultback to summary
private <T> DomainResult<T> createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, ForeignKeyDescriptor.Nature nature, FetchParent fetchParent, DomainResultCreationState creationState)
createKeyDomainResultback to summary
public DomainResult<?> createKeyDomainResult(NavigablePath navigablePath, TableGroup targetTableGroup, FetchParent fetchParent, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.createKeyDomainResult.

Doc from org.hibernate.metamodel.mapping.ForeignKeyDescriptor.createKeyDomainResult.

Create a DomainResult for the referring-side of the fk The table group must be the one containing the target.

Annotations
@Override
createKeyDomainResultback to summary
public DomainResult<?> createKeyDomainResult(NavigablePath navigablePath, TableGroup targetTableGroup, ForeignKeyDescriptor.Nature fromSide, FetchParent fetchParent, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.createKeyDomainResult.

Doc from org.hibernate.metamodel.mapping.ForeignKeyDescriptor.createKeyDomainResult.

Create a DomainResult for the referring-side of the fk The table group must be the one containing the target. The Nature is the association side of the foreign key i.e. Association#getSideNature().

Annotations
@Override
createTargetDomainResultback to summary
public DomainResult<?> createTargetDomainResult(NavigablePath navigablePath, TableGroup targetTableGroup, FetchParent fetchParent, DomainResultCreationState creationState)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.createTargetDomainResult.

Doc from org.hibernate.metamodel.mapping.ForeignKeyDescriptor.createTargetDomainResult.

Create a DomainResult for the target-side of the fk The table group must be the one containing the target

Annotations
@Override
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
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
generateJoinPredicateback to summary
public Predicate generateJoinPredicate(TableGroup targetSideTableGroup, TableGroup keySideTableGroup, SqlAstCreationState creationState)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.generateJoinPredicate.

Annotations
@Override
generateJoinPredicateback to summary
public Predicate generateJoinPredicate(TableReference targetSideReference, TableReference keySideReference, SqlAstCreationState creationState)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.generateJoinPredicate.

Annotations
@Override
getAssociationKeyback to summary
public AssociationKey getAssociationKey()

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.getAssociationKey.

Annotations
@Override
getAssociationKeyFromSideback to summary
public Object getAssociationKeyFromSide(Object targetObject, ForeignKeyDescriptor.Side side, SharedSessionContractImplementor session)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.getAssociationKeyFromSide.

Annotations
@Override
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(final int index)

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

Annotations
@Override
getKeyPartback to summary
public EmbeddableValuedModelPart getKeyPart()

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.getKeyPart.

Annotations
@Override
getKeySideback to summary
public ForeignKeyDescriptor.Side getKeySide()

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.getKeySide.

Annotations
@Override
getKeyTableback to summary
public String getKeyTable()

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.getKeyTable.

Annotations
@Override
getMappedTypeback to summary
public MappingType getMappedType()

Implements org.hibernate.metamodel.mapping.ValueMapping.getMappedType.

Doc from org.hibernate.metamodel.mapping.ValueMapping.getMappedType.

Descriptor for the type of this mapping

Annotations
@Override
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
getSelectableback to summary
public SelectableMapping getSelectable(int columnIndex)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.getSelectable.

Doc from org.hibernate.metamodel.mapping.SelectableMappings.getSelectable.

Get the selectable at the given position

Annotations
@Override
getTargetPartback to summary
public EmbeddableValuedModelPart getTargetPart()

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.getTargetPart.

Annotations
@Override
getTargetSideback to summary
public ForeignKeyDescriptor.Side getTargetSide()

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.getTargetSide.

Annotations
@Override
getTargetTableback to summary
public String getTargetTable()

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.getTargetTable.

Annotations
@Override
getUnderlyingTableGroupback to summary
private static TableGroup getUnderlyingTableGroup(TableGroup tableGroup)
hasConstraintback to summary
public boolean hasConstraint()

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.hasConstraint.

Annotations
@Override
hasPartitionedSelectionMappingback to summary
public boolean hasPartitionedSelectionMapping()

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

Annotations
@Override
isEmbeddedback to summary
public boolean isEmbedded()

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.isEmbedded.

Annotations
@Override
isKeyPartback to summary
public boolean isKeyPart(ValuedModelPart modelPart)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.isKeyPart.

Annotations
@Override
isSimpleJoinPredicateback to summary
public boolean isSimpleJoinPredicate(Predicate predicate)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.isSimpleJoinPredicate.

Annotations
@Override
isTargetTableGroupback to summary
private boolean isTargetTableGroup(TableGroup tableGroup)
visitKeySelectablesback to summary
public int visitKeySelectables(int offset, SelectableConsumer consumer)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.visitKeySelectables.

Annotations
@Override
visitTargetSelectablesback to summary
public int visitTargetSelectables(int offset, SelectableConsumer consumer)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.visitTargetSelectables.

Annotations
@Override
withKeySelectionMappingback to summary
public ForeignKeyDescriptor withKeySelectionMapping(ManagedMappingType declaringType, TableGroupProducer declaringTableGroupProducer, IntFunction<SelectableMapping> selectableMappingAccess, MappingModelCreationProcess creationProcess)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.withKeySelectionMapping.

Doc from org.hibernate.metamodel.mapping.ForeignKeyDescriptor.withKeySelectionMapping.

Return a copy of this foreign key descriptor with the selectable mappings as provided by the given accessor.

Annotations
@Override
withTargetPartback to summary
public ForeignKeyDescriptor withTargetPart(ValuedModelPart targetPart)

Implements org.hibernate.metamodel.mapping.ForeignKeyDescriptor.withTargetPart.

Doc from org.hibernate.metamodel.mapping.ForeignKeyDescriptor.withTargetPart.

Return a copy of this foreign key descriptor with the target part as given by the argument.

Annotations
@Override