Class SimpleForeignKeyDescriptor
- java.lang.Object
-
- org.hibernate.metamodel.mapping.internal.SimpleForeignKeyDescriptor
-
- All Implemented Interfaces:
BasicValuedMapping
,BasicValuedModelPart
,Bindable
,ForeignKeyDescriptor
,JdbcMappingContainer
,MappingModelExpressible
,ModelPart
,SelectableMapping
,SqlExpressible
,SqlTypedMapping
,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.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.JdbcValueConsumer
-
-
Field Summary
-
Fields inherited from interface org.hibernate.metamodel.mapping.ForeignKeyDescriptor
PART_NAME, TARGET_PART_NAME
-
-
Constructor Summary
Constructors Constructor Description SimpleForeignKeyDescriptor(ManagedMappingType keyDeclaringType, BasicValuedModelPart keyModelPart, PropertyAccess keyPropertyAccess, SelectableMapping keySelectableMapping, BasicValuedModelPart targetModelPart, boolean refersToPrimaryKey, boolean hasConstraint)
SimpleForeignKeyDescriptor(ManagedMappingType keyDeclaringType, BasicValuedModelPart keyModelPart, PropertyAccess keyPropertyAccess, SelectableMapping keySelectableMapping, BasicValuedModelPart targetModelPart, boolean refersToPrimaryKey, boolean hasConstraint, boolean swapDirection)
-
Method Summary
-
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.BasicValuedMapping
getJdbcTypeCount
-
Methods inherited from interface org.hibernate.metamodel.mapping.Bindable
forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue
-
Methods inherited from interface org.hibernate.sql.results.graph.Fetchable
asAttributeMapping, incrementFetchDepth, resolveCircularFetch
-
Methods inherited from interface org.hibernate.metamodel.mapping.ForeignKeyDescriptor
forEachSelectable, getPart, getPartName, getSide, getTable, visitKeySelectables, visitTargetSelectables
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
areEqual, forEachSelectable
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValueMapping
getExpressibleJavaType, treatAs
-
-
-
-
Constructor Detail
-
SimpleForeignKeyDescriptor
public SimpleForeignKeyDescriptor(ManagedMappingType keyDeclaringType, BasicValuedModelPart keyModelPart, PropertyAccess keyPropertyAccess, SelectableMapping keySelectableMapping, BasicValuedModelPart targetModelPart, boolean refersToPrimaryKey, boolean hasConstraint)
-
SimpleForeignKeyDescriptor
public SimpleForeignKeyDescriptor(ManagedMappingType keyDeclaringType, BasicValuedModelPart keyModelPart, PropertyAccess keyPropertyAccess, SelectableMapping keySelectableMapping, BasicValuedModelPart targetModelPart, boolean refersToPrimaryKey, boolean hasConstraint, boolean swapDirection)
-
-
Method Detail
-
getKeyTable
public String getKeyTable()
- Specified by:
getKeyTable
in interfaceForeignKeyDescriptor
-
getTargetTable
public String getTargetTable()
- Specified by:
getTargetTable
in interfaceForeignKeyDescriptor
-
getKeyPart
public BasicValuedModelPart getKeyPart()
- Specified by:
getKeyPart
in interfaceForeignKeyDescriptor
-
getTargetPart
public BasicValuedModelPart getTargetPart()
- Specified by:
getTargetPart
in interfaceForeignKeyDescriptor
-
getKeySide
public ForeignKeyDescriptor.Side getKeySide()
- Specified by:
getKeySide
in interfaceForeignKeyDescriptor
-
getTargetSide
public ForeignKeyDescriptor.Side getTargetSide()
- Specified by:
getTargetSide
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
-
createKeyDomainResult
public DomainResult<?> createKeyDomainResult(NavigablePath navigablePath, TableGroup tableGroup, FetchParent fetchParent, DomainResultCreationState creationState)
Description copied from interface:ForeignKeyDescriptor
Create a DomainResult for the referring-side of the fk- Specified by:
createKeyDomainResult
in interfaceForeignKeyDescriptor
-
createTargetDomainResult
public DomainResult<?> createTargetDomainResult(NavigablePath navigablePath, TableGroup tableGroup, FetchParent fetchParent, DomainResultCreationState creationState)
Description copied from interface:ForeignKeyDescriptor
Create a DomainResult for the target-side of the fk- Specified by:
createTargetDomainResult
in interfaceForeignKeyDescriptor
-
createDomainResult
public DomainResult<?> createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, ForeignKeyDescriptor.Nature side, FetchParent fetchParent, DomainResultCreationState creationState)
- Specified by:
createDomainResult
in interfaceForeignKeyDescriptor
-
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 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 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 interfaceModelPart
-
generateJoinPredicate
public Predicate generateJoinPredicate(TableReference targetSideReference, TableReference keySideReference, SqlExpressionResolver sqlExpressionResolver, SqlAstCreationContext creationContext)
- Specified by:
generateJoinPredicate
in interfaceForeignKeyDescriptor
-
generateJoinPredicate
public Predicate generateJoinPredicate(TableGroup targetSideTableGroup, TableGroup keySideTableGroup, SqlExpressionResolver sqlExpressionResolver, SqlAstCreationContext creationContext)
- Specified by:
generateJoinPredicate
in interfaceForeignKeyDescriptor
-
isSimpleJoinPredicate
public boolean isSimpleJoinPredicate(Predicate predicate)
- Specified by:
isSimpleJoinPredicate
in interfaceForeignKeyDescriptor
-
getPartMappingType
public MappingType getPartMappingType()
- Specified by:
getPartMappingType
in interfaceBasicValuedModelPart
- Specified by:
getPartMappingType
in interfaceModelPart
-
getJavaType
public JavaType<?> getJavaType()
- Specified by:
getJavaType
in interfaceModelPart
-
getNavigableRole
public NavigableRole getNavigableRole()
- Specified by:
getNavigableRole
in interfaceModelPart
- See Also:
ModelPart.getPartName()
-
findContainingEntityMapping
public EntityMappingType findContainingEntityMapping()
- Specified by:
findContainingEntityMapping
in interfaceModelPart
-
disassemble
public Object disassemble(Object value, SharedSessionContractImplementor session)
- Specified by:
disassemble
in interfaceBindable
- See Also:
As an example, consider the following domain model: ````
-
getAssociationKeyFromSide
public Object getAssociationKeyFromSide(Object targetObject, ForeignKeyDescriptor.Nature nature, SharedSessionContractImplementor session)
- Specified by:
getAssociationKeyFromSide
in interfaceForeignKeyDescriptor
-
forEachDisassembledJdbcValue
public int forEachDisassembledJdbcValue(Object value, Clause clause, int offset, Bindable.JdbcValuesConsumer valuesConsumer, SharedSessionContractImplementor session)
- Specified by:
forEachDisassembledJdbcValue
in interfaceBindable
-
breakDownJdbcValues
public void breakDownJdbcValues(Object domainValue, ModelPart.JdbcValueConsumer valueConsumer, SharedSessionContractImplementor session)
- Specified by:
breakDownJdbcValues
in interfaceModelPart
-
visitKeySelectables
public int visitKeySelectables(int offset, SelectableConsumer consumer)
- Specified by:
visitKeySelectables
in interfaceForeignKeyDescriptor
-
visitTargetSelectables
public int visitTargetSelectables(int offset, SelectableConsumer consumer)
- Specified by:
visitTargetSelectables
in interfaceForeignKeyDescriptor
-
hasConstraint
public boolean hasConstraint()
- Specified by:
hasConstraint
in interfaceForeignKeyDescriptor
-
getAssociationKey
public AssociationKey getAssociationKey()
- Specified by:
getAssociationKey
in interfaceForeignKeyDescriptor
-
getJdbcMappings
public List<JdbcMapping> getJdbcMappings()
Description copied from interface:Bindable
The list of JDBC mappings- Specified by:
getJdbcMappings
in interfaceBasicValuedMapping
- Specified by:
getJdbcMappings
in interfaceBindable
- Specified by:
getJdbcMappings
in interfaceJdbcMappingContainer
-
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 interfaceJdbcMappingContainer
-
forEachJdbcValue
public int forEachJdbcValue(Object value, Clause clause, int offset, Bindable.JdbcValuesConsumer valuesConsumer, SharedSessionContractImplementor session)
- Specified by:
forEachJdbcValue
in interfaceBindable
-
getContainingTableExpression
public String getContainingTableExpression()
- Specified by:
getContainingTableExpression
in interfaceSelectableMapping
-
getSelectionExpression
public String getSelectionExpression()
- Specified by:
getSelectionExpression
in interfaceSelectableMapping
-
isFormula
public boolean isFormula()
- Specified by:
isFormula
in interfaceSelectableMapping
-
getCustomReadExpression
public String getCustomReadExpression()
- Specified by:
getCustomReadExpression
in interfaceSelectableMapping
-
getCustomWriteExpression
public String getCustomWriteExpression()
- Specified by:
getCustomWriteExpression
in interfaceSelectableMapping
-
getColumnDefinition
public String getColumnDefinition()
- Specified by:
getColumnDefinition
in interfaceSqlTypedMapping
-
getLength
public Long getLength()
- Specified by:
getLength
in interfaceSqlTypedMapping
-
getPrecision
public Integer getPrecision()
- Specified by:
getPrecision
in interfaceSqlTypedMapping
-
getScale
public Integer getScale()
- Specified by:
getScale
in interfaceSqlTypedMapping
-
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
-
getStyle
public FetchStyle getStyle()
- Specified by:
getStyle
in interfaceFetchStyleAccess
-
getTiming
public FetchTiming getTiming()
- Specified by:
getTiming
in interfaceFetchTimingAccess
-
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
-
getMappedType
public MappingType getMappedType()
Description copied from interface:ValueMapping
Descriptor for the type of this mapping- Specified by:
getMappedType
in interfaceValueMapping
-
getJdbcMapping
public JdbcMapping 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
-
-