Class SimpleForeignKeyDescriptor
java.lang.Object
org.hibernate.metamodel.mapping.internal.SimpleForeignKeyDescriptor
- All Implemented Interfaces:
BasicValuedMapping
,BasicValuedModelPart
,Bindable
,ForeignKeyDescriptor
,JdbcMappingContainer
,MappingModelExpressible
,ModelPart
,SelectableMapping
,SelectableMappings
,SqlExpressible
,SqlTypedMapping
,ValuedModelPart
,ValueMapping
,VirtualModelPart
,Fetchable
,FetchOptions
,FetchStyleAccess
,FetchTimingAccess
,JavaTypedExpressible
public class SimpleForeignKeyDescriptor
extends Object
implements ForeignKeyDescriptor, BasicValuedModelPart, FetchOptions
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.Bindable
Bindable.JdbcValuesBiConsumer<X,
Y>, Bindable.JdbcValuesConsumer Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.ForeignKeyDescriptor
ForeignKeyDescriptor.Nature, ForeignKeyDescriptor.Side
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.ModelPart
ModelPart.JdbcValueBiConsumer<X,
Y>, ModelPart.JdbcValueConsumer -
Field Summary
Fields inherited from interface org.hibernate.metamodel.mapping.ForeignKeyDescriptor
PART_NAME, TARGET_PART_NAME
-
Constructor Summary
ModifierConstructorDescriptionSimpleForeignKeyDescriptor
(BasicValuedModelPart keyModelPart, BasicValuedModelPart targetModelPart, boolean refersToPrimaryKey, boolean hasConstraint, boolean swapDirection) protected
SimpleForeignKeyDescriptor
(ManagedMappingType keyDeclaringType, BasicValuedModelPart keyModelPart, PropertyAccess keyPropertyAccess, SelectableMapping keySelectableMapping, BasicValuedModelPart targetModelPart, boolean insertable, boolean updateable, boolean refersToPrimaryKey, boolean hasConstraint) SimpleForeignKeyDescriptor
(ManagedMappingType keyDeclaringType, SelectableMapping keySelectableMapping, BasicValuedModelPart targetModelPart, boolean refersToPrimaryKey, boolean hasConstraint) SimpleForeignKeyDescriptor
(ManagedMappingType keyDeclaringType, SelectableMapping keySelectableMapping, PropertyAccess valueAccess, BasicValuedModelPart targetModelPart, boolean refersToPrimaryKey, boolean hasConstraint, boolean swapDirection) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToCacheKey
(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session) Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.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.<X,
Y> int breakDownJdbcValues
(Object domainValue, int offset, X x, Y y, ModelPart.JdbcValueBiConsumer<X, Y> valueConsumer, SharedSessionContractImplementor session) Breaks down the domain value to its constituent JDBC values.int
Compare the 2 values<T> DomainResult<T>
createDomainResult
(NavigablePath navigablePath, TableGroup targetTableGroup, String resultVariable, DomainResultCreationState creationState) Create a DomainResult for the referring-side of the fk The table group must be the one containing the target.DomainResult<?>
createKeyDomainResult
(NavigablePath navigablePath, TableGroup targetTableGroup, ForeignKeyDescriptor.Nature fromSide, FetchParent fetchParent, DomainResultCreationState creationState) Create a DomainResult for the referring-side of the fk The table group must be the one containing the target.DomainResult<?>
createKeyDomainResult
(NavigablePath navigablePath, TableGroup targetTableGroup, FetchParent fetchParent, DomainResultCreationState creationState) Create a DomainResult for the referring-side of the fk The table group must be the one containing the target.DomainResult<?>
createTargetDomainResult
(NavigablePath navigablePath, TableGroup targetTableGroup, FetchParent fetchParent, DomainResultCreationState creationState) Create a DomainResult for the target-side of the fk The table group must be the one containing the targetdisassemble
(Object value, SharedSessionContractImplementor session) Breaks down a value ofJ
into its simple pieces.<X,
Y> int forEachDisassembledJdbcValue
(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X, Y> valuesConsumer, SharedSessionContractImplementor session) LikeBindable.forEachDisassembledJdbcValue(Object, Object, Object, JdbcValuesBiConsumer, SharedSessionContractImplementor)
, but additionally receives an offset by which the selectionIndex is incremented when callingBindable.JdbcValuesBiConsumer.consume(int, Object, Object, Object, JdbcMapping)
.int
forEachJdbcType
(int offset, IndexedConsumer<JdbcMapping> action) Visit each JdbcMapping starting from the given offset<X,
Y> int forEachJdbcValue
(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X, Y> valuesConsumer, SharedSessionContractImplementor session) Visit each constituent JDBC value extracted from the entity instance itself.int
forEachSelectable
(int offset, SelectableConsumer consumer) Visits the FK "referring" columnsgenerateFetch
(FetchParent fetchParent, NavigablePath fetchablePath, FetchTiming fetchTiming, boolean selected, String resultVariable, DomainResultCreationState creationState) Generates a Fetch of this fetchablegenerateJoinPredicate
(TableGroup targetSideTableGroup, TableGroup keySideTableGroup, SqlAstCreationState creationState) generateJoinPredicate
(TableReference targetSideReference, TableReference keySideReference, SqlAstCreationState creationState) getAssociationKeyFromSide
(Object targetObject, ForeignKeyDescriptor.Side side, SharedSessionContractImplementor session) The table which contains the columns mapped by this valueThe selection's read expression accounting for formula treatment as well asColumnTransformer.read()
The selection's write expression accountingColumnTransformer.write()
int
The key that identifies this Fetchable within aFetchableContainer
.The name of the fetchable.JavaType<?>
The Java type for this part.Anything that is expressible at the SQL AST level would be of basic type.getJdbcMapping
(int index) The configured fetch timing and styleDescriptor for the type of this mappingThe type for this part.getScale()
getSelectable
(int columnIndex) Get the selectable at the given positionThe selection's expression.getStyle()
boolean
boolean
boolean
Is the mapping a formula instead of a physical column?boolean
boolean
isKeyPart
(ValuedModelPart modelPart) boolean
Is the mapping considered nullable?boolean
boolean
isSimpleJoinPredicate
(Predicate predicate) boolean
toString()
int
visitKeySelectables
(int offset, SelectableConsumer consumer) int
visitTargetSelectables
(int offset, SelectableConsumer consumer) withKeySelectionMapping
(ManagedMappingType declaringType, TableGroupProducer declaringTableGroupProducer, IntFunction<SelectableMapping> selectableMappingAccess, MappingModelCreationProcess creationProcess) Return a copy of this foreign key descriptor with the selectable mappings as provided by the given accessor.withTargetPart
(ValuedModelPart targetPart) Return a copy of this foreign key descriptor with the target part as given by the argument.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.hibernate.metamodel.mapping.BasicValuedModelPart
asBasicValuedModelPart, forEachSelectable, getJdbcTypeCount, hasPartitionedSelectionMapping
Methods inherited from interface org.hibernate.metamodel.mapping.Bindable
forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachJdbcValue, forEachJdbcValue
Methods inherited from interface org.hibernate.sql.results.graph.Fetchable
asAttributeMapping, incrementFetchDepth, isSelectable, resolveCircularFetch
Methods inherited from interface org.hibernate.metamodel.mapping.ForeignKeyDescriptor
getAssociationKeyFromSide, getPart, getPartName, getSide, visitKeySelectables, visitTargetSelectables
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
areEqual, asEntityMappingType, breakDownJdbcValues, decompose, decompose, isEntityIdentifierMapping
Methods inherited from interface org.hibernate.metamodel.mapping.SelectableMapping
getSelectableName, getSelectablePath, getWriteExpression
Methods inherited from interface org.hibernate.metamodel.mapping.SqlTypedMapping
isLob, toSize
Methods inherited from interface org.hibernate.metamodel.mapping.ValuedModelPart
forEachInsertable, forEachNonFormula, forEachUpdatable, getJdbcTypeCount
Methods inherited from interface org.hibernate.metamodel.mapping.ValueMapping
getExpressibleJavaType, treatAs
Methods inherited from interface org.hibernate.metamodel.mapping.VirtualModelPart
isVirtual
-
Constructor Details
-
SimpleForeignKeyDescriptor
public SimpleForeignKeyDescriptor(ManagedMappingType keyDeclaringType, BasicValuedModelPart keyModelPart, PropertyAccess keyPropertyAccess, SelectableMapping keySelectableMapping, BasicValuedModelPart targetModelPart, boolean insertable, boolean updateable, boolean refersToPrimaryKey, boolean hasConstraint) -
SimpleForeignKeyDescriptor
public SimpleForeignKeyDescriptor(BasicValuedModelPart keyModelPart, BasicValuedModelPart targetModelPart, boolean refersToPrimaryKey, boolean hasConstraint, boolean swapDirection) -
SimpleForeignKeyDescriptor
public SimpleForeignKeyDescriptor(ManagedMappingType keyDeclaringType, SelectableMapping keySelectableMapping, BasicValuedModelPart targetModelPart, boolean refersToPrimaryKey, boolean hasConstraint) -
SimpleForeignKeyDescriptor
public SimpleForeignKeyDescriptor(ManagedMappingType keyDeclaringType, SelectableMapping keySelectableMapping, PropertyAccess valueAccess, BasicValuedModelPart targetModelPart, boolean refersToPrimaryKey, boolean hasConstraint, boolean swapDirection) -
SimpleForeignKeyDescriptor
-
-
Method Details
-
getKeyTable
- Specified by:
getKeyTable
in interfaceForeignKeyDescriptor
-
getTargetTable
- Specified by:
getTargetTable
in interfaceForeignKeyDescriptor
-
getKeyPart
- Specified by:
getKeyPart
in interfaceForeignKeyDescriptor
-
getTargetPart
- Specified by:
getTargetPart
in interfaceForeignKeyDescriptor
-
isKeyPart
- Specified by:
isKeyPart
in interfaceForeignKeyDescriptor
-
getKeySide
- Specified by:
getKeySide
in interfaceForeignKeyDescriptor
-
getTargetSide
- Specified by:
getTargetSide
in interfaceForeignKeyDescriptor
-
compare
Description copied from interface:ForeignKeyDescriptor
Compare the 2 values- Specified by:
compare
in interfaceForeignKeyDescriptor
-
withKeySelectionMapping
public ForeignKeyDescriptor withKeySelectionMapping(ManagedMappingType declaringType, TableGroupProducer declaringTableGroupProducer, IntFunction<SelectableMapping> selectableMappingAccess, MappingModelCreationProcess creationProcess) Description copied from interface:ForeignKeyDescriptor
Return a copy of this foreign key descriptor with the selectable mappings as provided by the given accessor.- Specified by:
withKeySelectionMapping
in interfaceForeignKeyDescriptor
-
withTargetPart
Description copied from interface:ForeignKeyDescriptor
Return a copy of this foreign key descriptor with the target part as given by the argument.- Specified by:
withTargetPart
in interfaceForeignKeyDescriptor
-
generateJoinPredicate
public Predicate generateJoinPredicate(TableReference targetSideReference, TableReference keySideReference, SqlAstCreationState creationState) - Specified by:
generateJoinPredicate
in interfaceForeignKeyDescriptor
-
generateJoinPredicate
public Predicate generateJoinPredicate(TableGroup targetSideTableGroup, TableGroup keySideTableGroup, SqlAstCreationState creationState) - Specified by:
generateJoinPredicate
in interfaceForeignKeyDescriptor
-
isSimpleJoinPredicate
- Specified by:
isSimpleJoinPredicate
in interfaceForeignKeyDescriptor
-
getPartMappingType
Description copied from interface:ModelPart
The type for this part.- Specified by:
getPartMappingType
in interfaceBasicValuedModelPart
- Specified by:
getPartMappingType
in interfaceModelPart
-
forEachSelectable
Description copied from interface:ForeignKeyDescriptor
Visits the FK "referring" columns- Specified by:
forEachSelectable
in interfaceBasicValuedModelPart
- Specified by:
forEachSelectable
in interfaceForeignKeyDescriptor
- Specified by:
forEachSelectable
in interfaceModelPart
- Specified by:
forEachSelectable
in interfaceSelectableMappings
- Specified by:
forEachSelectable
in interfaceValuedModelPart
- See Also:
-
getJavaType
Description copied from interface:ModelPart
The Java type for this part. Generally equivalent toMappingType.getMappedJavaType()
relative toModelPart.getPartMappingType()
- Specified by:
getJavaType
in interfaceModelPart
-
findContainingEntityMapping
- Specified by:
findContainingEntityMapping
in interfaceModelPart
-
visitKeySelectables
- Specified by:
visitKeySelectables
in interfaceForeignKeyDescriptor
-
visitTargetSelectables
- Specified by:
visitTargetSelectables
in interfaceForeignKeyDescriptor
-
hasConstraint
public boolean hasConstraint()- Specified by:
hasConstraint
in interfaceForeignKeyDescriptor
-
getAssociationKey
- Specified by:
getAssociationKey
in interfaceForeignKeyDescriptor
-
getJdbcMapping
- Specified by:
getJdbcMapping
in interfaceBasicValuedMapping
- Specified by:
getJdbcMapping
in interfaceBasicValuedModelPart
- Specified by:
getJdbcMapping
in interfaceJdbcMappingContainer
- Specified by:
getJdbcMapping
in interfaceSqlExpressible
-
getSingleJdbcMapping
- Specified by:
getSingleJdbcMapping
in interfaceBasicValuedMapping
- Specified by:
getSingleJdbcMapping
in interfaceBasicValuedModelPart
- Specified by:
getSingleJdbcMapping
in interfaceJdbcMappingContainer
- Specified by:
getSingleJdbcMapping
in interfaceValuedModelPart
-
forEachJdbcType
Description copied from interface:JdbcMappingContainer
Visit each JdbcMapping starting from the given offset- Specified by:
forEachJdbcType
in interfaceJdbcMappingContainer
-
getContainingTableExpression
Description copied from interface:ValuedModelPart
The table which contains the columns mapped by this value- Specified by:
getContainingTableExpression
in interfaceForeignKeyDescriptor
- Specified by:
getContainingTableExpression
in interfaceSelectableMapping
- Specified by:
getContainingTableExpression
in interfaceValuedModelPart
-
getSelectionExpression
Description copied from interface:SelectableMapping
The selection's expression. This is the column name or formula- Specified by:
getSelectionExpression
in interfaceSelectableMapping
-
getSelectable
Description copied from interface:SelectableMappings
Get the selectable at the given position- Specified by:
getSelectable
in interfaceBasicValuedModelPart
- Specified by:
getSelectable
in interfaceForeignKeyDescriptor
- Specified by:
getSelectable
in interfaceSelectableMappings
-
isFormula
public boolean isFormula()Description copied from interface:SelectableMapping
Is the mapping a formula instead of a physical column?- Specified by:
isFormula
in interfaceSelectableMapping
-
isNullable
public boolean isNullable()Description copied from interface:SelectableMapping
Is the mapping considered nullable?- Specified by:
isNullable
in interfaceSelectableMapping
-
isInsertable
public boolean isInsertable()- Specified by:
isInsertable
in interfaceSelectableMapping
-
isUpdateable
public boolean isUpdateable()- Specified by:
isUpdateable
in interfaceSelectableMapping
-
isPartitioned
public boolean isPartitioned()- Specified by:
isPartitioned
in interfaceSelectableMapping
-
getCustomReadExpression
Description copied from interface:SelectableMapping
The selection's read expression accounting for formula treatment as well asColumnTransformer.read()
- Specified by:
getCustomReadExpression
in interfaceSelectableMapping
-
getCustomWriteExpression
Description copied from interface:SelectableMapping
The selection's write expression accountingColumnTransformer.write()
- Specified by:
getCustomWriteExpression
in interfaceSelectableMapping
-
getColumnDefinition
- Specified by:
getColumnDefinition
in interfaceSqlTypedMapping
-
getLength
- Specified by:
getLength
in interfaceSqlTypedMapping
-
getPrecision
- Specified by:
getPrecision
in interfaceSqlTypedMapping
-
getScale
- Specified by:
getScale
in interfaceSqlTypedMapping
-
getTemporalPrecision
- Specified by:
getTemporalPrecision
in interfaceSqlTypedMapping
-
getFetchableName
Description copied from interface:Fetchable
The name of the fetchable. This is the part's "local name".- Specified by:
getFetchableName
in interfaceFetchable
- See Also:
-
getFetchableKey
public int getFetchableKey()Description copied from interface:Fetchable
The 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.
Fetch
objects in an array.- Specified by:
getFetchableKey
in interfaceFetchable
-
getMappedFetchOptions
Description copied from interface:Fetchable
The configured fetch timing and style- Specified by:
getMappedFetchOptions
in interfaceFetchable
-
getStyle
- Specified by:
getStyle
in interfaceFetchStyleAccess
-
getTiming
- Specified by:
getTiming
in interfaceFetchTimingAccess
-
getMappedType
Description copied from interface:ValueMapping
Descriptor for the type of this mapping- Specified by:
getMappedType
in interfaceValueMapping
-
getJdbcMapping
Description copied from interface:SqlExpressible
Anything that is expressible at the SQL AST level would be of basic type.- Specified by:
getJdbcMapping
in interfaceBasicValuedMapping
- Specified by:
getJdbcMapping
in interfaceSqlExpressible
- Specified by:
getJdbcMapping
in interfaceSqlTypedMapping
-
toString
-
isEmbedded
public boolean isEmbedded()- Specified by:
isEmbedded
in interfaceForeignKeyDescriptor
-