Class ToOneAttributeMapping
- java.lang.Object
-
- org.hibernate.metamodel.mapping.internal.AbstractAttributeMapping
-
- org.hibernate.metamodel.mapping.internal.AbstractStateArrayContributorMapping
-
- org.hibernate.metamodel.mapping.internal.AbstractSingularAttributeMapping
-
- org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping
-
- All Implemented Interfaces:
Association
,AttributeMapping
,Bindable
,EntityAssociationMapping
,EntityValuedModelPart
,JdbcMappingContainer
,MappingModelExpressible
,ModelPart
,ModelPartContainer
,OwnedValuedModelPart
,PropertyBasedMapping
,SelectableMappings
,SingularAttributeMapping
,ValuedModelPart
,ValueMapping
,LazyTableGroup.ParentTableGroupUseChecker
,TableGroupJoinProducer
,TableGroupProducer
,DatabaseSnapshotContributor
,EntityValuedFetchable
,Fetchable
,FetchableContainer
,FetchOptions
,FetchStyleAccess
,FetchTimingAccess
,JavaTypedExpressible
,MutabilityPlanExposer
public class ToOneAttributeMapping extends AbstractSingularAttributeMapping implements EntityValuedFetchable, EntityAssociationMapping, TableGroupJoinProducer, LazyTableGroup.ParentTableGroupUseChecker
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ToOneAttributeMapping.Cardinality
static class
ToOneAttributeMapping.NullDomainResult
-
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.ModelPart
ModelPart.JdbcValueBiConsumer<X,Y>, ModelPart.JdbcValueConsumer
-
-
Constructor Summary
Constructors Modifier Constructor Description ToOneAttributeMapping(String name, NavigableRole navigableRole, int stateArrayPosition, int fetchableIndex, ToOne bootValue, AttributeMetadata attributeMetadata, FetchTiming mappedFetchTiming, FetchStyle mappedFetchStyle, EntityMappingType entityMappingType, ManagedMappingType declaringType, EntityPersister declaringEntityPersister, PropertyAccess propertyAccess)
ToOneAttributeMapping(String name, NavigableRole navigableRole, int stateArrayPosition, int fetchableIndex, ToOne bootValue, AttributeMetadata attributeMetadata, FetchOptions mappedFetchOptions, EntityMappingType entityMappingType, ManagedMappingType declaringType, EntityPersister declaringEntityPersister, PropertyAccess propertyAccess)
protected
ToOneAttributeMapping(ToOneAttributeMapping original)
For Hibernate Reactive
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addPrefixedPropertyNames(Set<String> targetKeyPropertyNames, String prefix, Type type, SessionFactoryImplementor factory)
static void
addPrefixedPropertyPaths(Set<String> targetKeyPropertyNames, String prefix, Type type, SessionFactoryImplementor factory)
void
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>
intbreakDownJdbcValues(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.protected EntityFetch
buildEntityDelayedFetch(FetchParent fetchParent, ToOneAttributeMapping fetchedAttribute, NavigablePath navigablePath, DomainResult<?> keyResult, boolean selectByUniqueKey, DomainResultCreationState creationState)
For Hibernate Reactiveprotected EntityFetch
buildEntityFetchJoined(FetchParent fetchParent, ToOneAttributeMapping toOneMapping, TableGroup tableGroup, DomainResult<?> keyResult, boolean isAffectedByFilter, NavigablePath navigablePath, DomainResultCreationState creationState)
For Hibernate Reactiveprotected EntityFetch
buildEntityFetchSelect(FetchParent fetchParent, ToOneAttributeMapping fetchedAttribute, NavigablePath navigablePath, DomainResult<?> keyResult, boolean selectByUniqueKey, boolean isAffectedByFilter, DomainResultCreationState creationState)
For Hibernate Reactiveboolean
canUseParentTableGroup(TableGroupProducer producer, NavigablePath navigablePath, ValuedModelPart valuedModelPart)
boolean
containsTableReference(String tableExpression)
ToOneAttributeMapping
copy(ManagedMappingType declaringType, TableGroupProducer declaringTableGroupProducer)
LazyTableGroup
createRootTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, @Nullable String explicitSourceAlias, @Nullable SqlAliasBase explicitSqlAliasBase, @Nullable SqlAstJoinType requestedJoinType, boolean fetched, @Nullable Consumer<Predicate> predicateConsumer, SqlAstCreationState creationState)
Create the "join", but return a TableGroup.<T> DomainResult<T>
createSnapshotDomainResult(NavigablePath navigablePath, TableGroup parentTableGroup, String resultVariable, DomainResultCreationState creationState)
Create a DomainResult to be used when selecting snapshots from the database.TableGroup
createTableGroupInternal(boolean canUseInnerJoins, NavigablePath navigablePath, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlAstCreationState creationState)
TableGroupJoin
createTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, @Nullable String explicitSourceAlias, @Nullable SqlAliasBase explicitSqlAliasBase, @Nullable SqlAstJoinType requestedJoinType, boolean fetched, boolean addsPredicate, SqlAstCreationState creationState)
Create a TableGroupJoin.SqlAstJoinType
determineSqlJoinType(TableGroup lhs, @Nullable SqlAstJoinType requestedJoinType, boolean fetched)
Object
disassemble(Object value, SharedSessionContractImplementor session)
Breaks down a value ofJ
into its simple pieces.protected static Object
extractAttributePathValue(Object domainValue, EntityMappingType entityType, String attributePath)
protected Object
extractValue(Object domainValue, SharedSessionContractImplementor session)
ModelPart
findSubPart(String name)
ModelPart
findSubPart(String name, EntityMappingType targetType)
<X,Y>
intforEachDisassembledJdbcValue(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>
intforEachJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> consumer, SharedSessionContractImplementor session)
Visit each constituent JDBC value extracted from the entity instance itself.int
forEachSelectable(int offset, SelectableConsumer consumer)
Visits each selectable mapping with the selectable index offset by the given value.EntityFetch
generateFetch(FetchParent fetchParent, NavigablePath fetchablePath, FetchTiming fetchTiming, boolean selected, String resultVariable, DomainResultCreationState creationState)
Generates a Fetch of this fetchableEntityMappingType
getAssociatedEntityMappingType()
ToOneAttributeMapping.Cardinality
getCardinality()
String
getContainingTableExpression()
The table which contains the columns mapped by this valueSqlAstJoinType
getDefaultSqlAstJoinType(TableGroup parentTableGroup)
EntityMappingType
getEntityMappingType()
The descriptor of the entity that is the type for this partFetchable
getFetchable(int position)
ForeignKeyDescriptor
getForeignKeyDescriptor()
The descriptor, allowing access to column(s), etcString
getIdentifyingColumnsTableExpression()
JdbcMapping
getJdbcMapping(int index)
int
getJdbcTypeCount()
The number of JDBC mappingsModelPart
getKeyTargetMatchPart()
The model sub-part relative to the associated entity type that is the target of this association's foreign-keyEntityMappingType
getMappedType()
Descriptor for the type of this mappingNavigableRole
getNavigableRole()
NotFoundAction
getNotFoundAction()
int
getNumberOfFetchables()
The number of fetchables in the containerString
getReferencedPropertyName()
SelectableMapping
getSelectable(int columnIndex)
Get the selectable at the given positionForeignKeyDescriptor.Nature
getSideNature()
Indicates which "side" of the foreign-key this association describesString
getSqlAliasStem()
Get the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedString
getTargetKeyPropertyName()
Set<String>
getTargetKeyPropertyNames()
boolean
hasNotFoundAction()
boolean
hasPartitionedSelectionMapping()
protected boolean
isBidirectionalAttributeName(NavigablePath parentNavigablePath, ModelPart parentModelPart, NavigablePath fetchablePath, DomainResultCreationState creationState)
boolean
isFkOptimizationAllowed()
boolean
isIgnoreNotFound()
boolean
isInternalLoadNullable()
boolean
isLazy()
boolean
isNullable()
boolean
isOptional()
boolean
isReferenceToPrimaryKey()
boolean
isSimpleJoinPredicate(Predicate predicate)
Returns whether the given predicate is a simple join predicate for this attribute.boolean
isUnwrapProxy()
protected Object
lazyInitialize(Object domainValue)
For Hibernate Reactive, because it doesn't support lazy initialization, it will override this method and skip it when possible.Fetch
resolveCircularFetch(NavigablePath fetchablePath, FetchParent fetchParent, FetchTiming fetchTiming, DomainResultCreationState creationState)
Check whether this Fetchable is considered a circular fetch.void
setForeignKeyDescriptor(ForeignKeyDescriptor foreignKeyDescriptor)
void
setIdentifyingColumnsTableExpression(String tableExpression)
String
toString()
-
Methods inherited from class org.hibernate.metamodel.mapping.internal.AbstractSingularAttributeMapping
getGenerator
-
Methods inherited from class org.hibernate.metamodel.mapping.internal.AbstractStateArrayContributorMapping
getFetchableName, getMappedFetchOptions, getStyle, getTiming
-
Methods inherited from class org.hibernate.metamodel.mapping.internal.AbstractAttributeMapping
getAttributeMetadata, getAttributeName, getDeclaringType, getFetchableKey, getJavaType, getPartMappingType, getPropertyAccess, getStateArrayPosition
-
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.AttributeMapping
asAttributeMapping, asEmbeddedAttributeMapping, asPluralAttributeMapping, compare, findContainingEntityMapping, getAttributeMetadata, getAttributeName, getDeclaringType, getExposedMutabilityPlan, getPartName, getPropertyAccess, getStateArrayPosition, getValue, isEmbeddedAttributeMapping, isPluralAttributeMapping, setValue
-
Methods inherited from interface org.hibernate.metamodel.mapping.Bindable
forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachJdbcValue, forEachJdbcValue
-
Methods inherited from interface org.hibernate.metamodel.mapping.EntityAssociationMapping
getFetchableName, incrementFetchDepth
-
Methods inherited from interface org.hibernate.metamodel.mapping.EntityValuedModelPart
createDomainResult, forEachSubPart, visitSubParts
-
Methods inherited from interface org.hibernate.sql.results.graph.Fetchable
getFetchableKey, getMappedFetchOptions, isSelectable
-
Methods inherited from interface org.hibernate.sql.results.graph.FetchableContainer
getKeyFetchable, getNumberOfFetchableKeys, getNumberOfKeyFetchables, getSelectableIndex, visitFetchables, visitFetchables, visitFetchables, visitKeyFetchables, visitKeyFetchables, visitKeyFetchables
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
areEqual, asBasicValuedModelPart, asEntityMappingType, breakDownJdbcValues, decompose, decompose, getJavaType, getPartMappingType, isEntityIdentifierMapping, isVirtual
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPartContainer
findByPath, findByPath, forEachSubPart
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValuedModelPart
forEachInsertable, forEachNonFormula, forEachSelectable, forEachUpdatable, getSingleJdbcMapping
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValueMapping
getExpressibleJavaType, treatAs
-
-
-
-
Constructor Detail
-
ToOneAttributeMapping
protected ToOneAttributeMapping(ToOneAttributeMapping original)
For Hibernate Reactive
-
ToOneAttributeMapping
public ToOneAttributeMapping(String name, NavigableRole navigableRole, int stateArrayPosition, int fetchableIndex, ToOne bootValue, AttributeMetadata attributeMetadata, FetchOptions mappedFetchOptions, EntityMappingType entityMappingType, ManagedMappingType declaringType, EntityPersister declaringEntityPersister, PropertyAccess propertyAccess)
-
ToOneAttributeMapping
public ToOneAttributeMapping(String name, NavigableRole navigableRole, int stateArrayPosition, int fetchableIndex, ToOne bootValue, AttributeMetadata attributeMetadata, FetchTiming mappedFetchTiming, FetchStyle mappedFetchStyle, EntityMappingType entityMappingType, ManagedMappingType declaringType, EntityPersister declaringEntityPersister, PropertyAccess propertyAccess)
-
-
Method Detail
-
addPrefixedPropertyPaths
public static void addPrefixedPropertyPaths(Set<String> targetKeyPropertyNames, String prefix, Type type, SessionFactoryImplementor factory)
-
addPrefixedPropertyNames
public static void addPrefixedPropertyNames(Set<String> targetKeyPropertyNames, String prefix, Type type, SessionFactoryImplementor factory)
-
copy
public ToOneAttributeMapping copy(ManagedMappingType declaringType, TableGroupProducer declaringTableGroupProducer)
-
setForeignKeyDescriptor
public void setForeignKeyDescriptor(ForeignKeyDescriptor foreignKeyDescriptor)
-
getIdentifyingColumnsTableExpression
public String getIdentifyingColumnsTableExpression()
-
setIdentifyingColumnsTableExpression
public void setIdentifyingColumnsTableExpression(String tableExpression)
-
getForeignKeyDescriptor
public ForeignKeyDescriptor getForeignKeyDescriptor()
Description copied from interface:Association
The descriptor, allowing access to column(s), etc- Specified by:
getForeignKeyDescriptor
in interfaceAssociation
-
getSideNature
public ForeignKeyDescriptor.Nature getSideNature()
Description copied from interface:Association
Indicates which "side" of the foreign-key this association describes- Specified by:
getSideNature
in interfaceAssociation
-
isReferenceToPrimaryKey
public boolean isReferenceToPrimaryKey()
- Specified by:
isReferenceToPrimaryKey
in interfaceEntityAssociationMapping
-
isFkOptimizationAllowed
public boolean isFkOptimizationAllowed()
- Specified by:
isFkOptimizationAllowed
in interfaceEntityAssociationMapping
-
hasPartitionedSelectionMapping
public boolean hasPartitionedSelectionMapping()
- Specified by:
hasPartitionedSelectionMapping
in interfaceModelPart
-
getReferencedPropertyName
public String getReferencedPropertyName()
-
getTargetKeyPropertyName
public String getTargetKeyPropertyName()
-
getTargetKeyPropertyNames
public Set<String> getTargetKeyPropertyNames()
- Specified by:
getTargetKeyPropertyNames
in interfaceEntityAssociationMapping
-
getCardinality
public ToOneAttributeMapping.Cardinality getCardinality()
-
getMappedType
public EntityMappingType getMappedType()
Description copied from interface:ValueMapping
Descriptor for the type of this mapping- Specified by:
getMappedType
in interfaceValueMapping
-
getEntityMappingType
public EntityMappingType getEntityMappingType()
Description copied from interface:EntityValuedModelPart
The descriptor of the entity that is the type for this part- Specified by:
getEntityMappingType
in interfaceEntityValuedModelPart
-
getNavigableRole
public NavigableRole getNavigableRole()
- Specified by:
getNavigableRole
in interfaceModelPart
- See Also:
ModelPart.getPartName()
-
findSubPart
public ModelPart findSubPart(String name)
- Specified by:
findSubPart
in interfaceEntityValuedModelPart
-
findSubPart
public ModelPart findSubPart(String name, EntityMappingType targetType)
- Specified by:
findSubPart
in interfaceEntityValuedModelPart
- Specified by:
findSubPart
in interfaceModelPartContainer
-
resolveCircularFetch
public Fetch resolveCircularFetch(NavigablePath fetchablePath, FetchParent fetchParent, FetchTiming fetchTiming, DomainResultCreationState creationState)
Description copied from interface:Fetchable
Check whether this Fetchable is considered a circular fetch.- Specified by:
resolveCircularFetch
in interfaceFetchable
- Parameters:
fetchablePath
- The overall path within the graph- Returns:
- The Fetch representing the circularity;
null
indicates the fetch is not circular
-
isBidirectionalAttributeName
protected boolean isBidirectionalAttributeName(NavigablePath parentNavigablePath, ModelPart parentModelPart, NavigablePath fetchablePath, DomainResultCreationState creationState)
-
buildEntityDelayedFetch
protected EntityFetch buildEntityDelayedFetch(FetchParent fetchParent, ToOneAttributeMapping fetchedAttribute, NavigablePath navigablePath, DomainResult<?> keyResult, boolean selectByUniqueKey, DomainResultCreationState creationState)
For Hibernate Reactive
-
buildEntityFetchSelect
protected EntityFetch buildEntityFetchSelect(FetchParent fetchParent, ToOneAttributeMapping fetchedAttribute, NavigablePath navigablePath, DomainResult<?> keyResult, boolean selectByUniqueKey, boolean isAffectedByFilter, DomainResultCreationState creationState)
For Hibernate Reactive
-
buildEntityFetchJoined
protected EntityFetch buildEntityFetchJoined(FetchParent fetchParent, ToOneAttributeMapping toOneMapping, TableGroup tableGroup, DomainResult<?> keyResult, boolean isAffectedByFilter, NavigablePath navigablePath, DomainResultCreationState creationState)
For Hibernate Reactive
-
generateFetch
public EntityFetch 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 interfaceEntityValuedFetchable
- 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
-
createSnapshotDomainResult
public <T> DomainResult<T> createSnapshotDomainResult(NavigablePath navigablePath, TableGroup parentTableGroup, String resultVariable, DomainResultCreationState creationState)
Description copied from interface:DatabaseSnapshotContributor
Create a DomainResult to be used when selecting snapshots from the database.By default, simply use
ModelPart.createDomainResult(org.hibernate.spi.NavigablePath, org.hibernate.sql.ast.tree.from.TableGroup, java.lang.String, org.hibernate.sql.results.graph.DomainResultCreationState)
- Specified by:
createSnapshotDomainResult
in interfaceDatabaseSnapshotContributor
-
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
-
containsTableReference
public boolean containsTableReference(String tableExpression)
- Specified by:
containsTableReference
in interfaceTableGroupProducer
-
getNumberOfFetchables
public int getNumberOfFetchables()
Description copied from interface:FetchableContainer
The number of fetchables in the container- Specified by:
getNumberOfFetchables
in interfaceFetchableContainer
-
getFetchable
public Fetchable getFetchable(int position)
- Specified by:
getFetchable
in interfaceFetchableContainer
-
createTableGroupJoin
public TableGroupJoin createTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, @Nullable String explicitSourceAlias, @Nullable SqlAliasBase explicitSqlAliasBase, @Nullable SqlAstJoinType requestedJoinType, boolean fetched, boolean addsPredicate, SqlAstCreationState creationState)
Description copied from interface:TableGroupJoinProducer
Create a TableGroupJoin.- Specified by:
createTableGroupJoin
in interfaceTableGroupJoinProducer
- Parameters:
navigablePath
- The NavigablePath to the joinlhs
- The join's (L)eft-(H)and (S)ideexplicitSqlAliasBase
- A specific SqlAliasBase to use. May benull
indicating one should be created using the SqlAliasBaseGenerator fromcreationState
requestedJoinType
- An explicit join-type. May be null to signal that the join is for an implicit path.addsPredicate
- Indicates there are explicit, additional predicates (from an SQM tree ON/WITH clause)
-
determineSqlJoinType
public SqlAstJoinType determineSqlJoinType(TableGroup lhs, @Nullable SqlAstJoinType requestedJoinType, boolean fetched)
- Specified by:
determineSqlJoinType
in interfaceTableGroupJoinProducer
-
createRootTableGroupJoin
public LazyTableGroup createRootTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, @Nullable String explicitSourceAlias, @Nullable SqlAliasBase explicitSqlAliasBase, @Nullable SqlAstJoinType requestedJoinType, boolean fetched, @Nullable Consumer<Predicate> predicateConsumer, SqlAstCreationState creationState)
Description copied from interface:TableGroupJoinProducer
Create the "join", but return a TableGroup. Intended for creating sub-query correlations. E.g., givenfrom SomeEntity e where exists ( select 1 from AnotherEntity a where e.association.attr = 1 )
We call this for the `e.association` path.- Specified by:
createRootTableGroupJoin
in interfaceTableGroupJoinProducer
- Parameters:
navigablePath
- The NavigablePath to the joinlhs
- The join's (L)eft-(H)and (S)ideexplicitSqlAliasBase
- A specific SqlAliasBase to use. May benull
indicating one should be created using the SqlAliasBaseGenerator fromcreationState
requestedJoinType
- An explicit join-type. May be null to signal that the join is for an implicit path.predicateConsumer
- Consumer for additional predicates from the producer's mapping.
-
canUseParentTableGroup
public boolean canUseParentTableGroup(TableGroupProducer producer, NavigablePath navigablePath, ValuedModelPart valuedModelPart)
- Specified by:
canUseParentTableGroup
in interfaceLazyTableGroup.ParentTableGroupUseChecker
-
createTableGroupInternal
public TableGroup createTableGroupInternal(boolean canUseInnerJoins, NavigablePath navigablePath, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlAstCreationState creationState)
-
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 generatedNote 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)
-
isNullable
public boolean isNullable()
-
isLazy
public boolean isLazy()
-
isOptional
public boolean isOptional()
- Specified by:
isOptional
in interfaceEntityValuedFetchable
-
isInternalLoadNullable
public boolean isInternalLoadNullable()
-
getNotFoundAction
public NotFoundAction getNotFoundAction()
-
isIgnoreNotFound
public boolean isIgnoreNotFound()
-
hasNotFoundAction
public boolean hasNotFoundAction()
-
isUnwrapProxy
public boolean isUnwrapProxy()
- Specified by:
isUnwrapProxy
in interfaceEntityValuedFetchable
-
getAssociatedEntityMappingType
public EntityMappingType getAssociatedEntityMappingType()
- Specified by:
getAssociatedEntityMappingType
in interfaceEntityAssociationMapping
-
getKeyTargetMatchPart
public ModelPart getKeyTargetMatchPart()
Description copied from interface:EntityAssociationMapping
The model sub-part relative to the associated entity type that is the target of this association's foreign-key- Specified by:
getKeyTargetMatchPart
in interfaceEntityAssociationMapping
-
breakDownJdbcValues
public <X,Y> int breakDownJdbcValues(Object domainValue, int offset, X x, Y y, ModelPart.JdbcValueBiConsumer<X,Y> valueConsumer, SharedSessionContractImplementor session)
Description copied from interface:ModelPart
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 valuesX
andY
to the consumer. Returns the amount of jdbc types that have been visited.- Specified by:
breakDownJdbcValues
in interfaceModelPart
-
extractValue
protected Object extractValue(Object domainValue, SharedSessionContractImplementor session)
-
lazyInitialize
protected Object lazyInitialize(Object domainValue)
For Hibernate Reactive, because it doesn't support lazy initialization, it will override this method and skip it when possible.
-
extractAttributePathValue
protected static Object extractAttributePathValue(Object domainValue, EntityMappingType entityType, String attributePath)
-
forEachSelectable
public int forEachSelectable(int offset, SelectableConsumer consumer)
Description copied from interface:ModelPart
Visits each selectable mapping with the selectable index offset by the given value. Returns the amount of jdbc types that have been visited.- Specified by:
forEachSelectable
in interfaceModelPart
- Specified by:
forEachSelectable
in interfaceSelectableMappings
- Specified by:
forEachSelectable
in interfaceValuedModelPart
- See Also:
SelectableConsumer.accept(int, SelectableMapping)
-
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 interfaceEntityValuedModelPart
- 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 interfaceEntityValuedModelPart
- Specified by:
applySqlSelections
in interfaceModelPart
-
getContainingTableExpression
public String getContainingTableExpression()
Description copied from interface:ValuedModelPart
The table which contains the columns mapped by this value- Specified by:
getContainingTableExpression
in interfaceValuedModelPart
-
getJdbcTypeCount
public int getJdbcTypeCount()
Description copied from interface:Bindable
The number of JDBC mappings- Specified by:
getJdbcTypeCount
in interfaceBindable
- Specified by:
getJdbcTypeCount
in interfaceEntityValuedModelPart
- Specified by:
getJdbcTypeCount
in interfaceJdbcMappingContainer
- Specified by:
getJdbcTypeCount
in interfaceSelectableMappings
- Specified by:
getJdbcTypeCount
in interfaceValuedModelPart
-
getJdbcMapping
public JdbcMapping getJdbcMapping(int index)
- Specified by:
getJdbcMapping
in interfaceJdbcMappingContainer
-
getSelectable
public SelectableMapping getSelectable(int columnIndex)
Description copied from interface:SelectableMappings
Get the selectable at the given position- Specified by:
getSelectable
in interfaceSelectableMappings
-
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 interfaceEntityValuedModelPart
- Specified by:
forEachJdbcType
in interfaceJdbcMappingContainer
-
disassemble
public Object disassemble(Object value, SharedSessionContractImplementor session)
Description copied from interface:Bindable
Breaks down a value ofJ
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 theBindable
for thePerson
entity to disassemble. Given aPerson
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.
- Specified by:
disassemble
in interfaceBindable
- Specified by:
disassemble
in interfaceEntityValuedModelPart
- See Also:
EntityEntry
-
addToCacheKey
public void addToCacheKey(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session)
Description copied from interface:Bindable
Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.- Specified by:
addToCacheKey
in interfaceBindable
- Specified by:
addToCacheKey
in interfaceEntityValuedModelPart
- Specified by:
addToCacheKey
in interfaceJavaTypedExpressible
- Parameters:
cacheKey
- the MutableCacheKey used to add the disassembled value and the hashCodevalue
- the value to disassemblesession
- the SharedSessionContractImplementor
-
forEachDisassembledJdbcValue
public <X,Y> int forEachDisassembledJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> valuesConsumer, SharedSessionContractImplementor session)
Description copied from interface:Bindable
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)
.- Specified by:
forEachDisassembledJdbcValue
in interfaceBindable
- Specified by:
forEachDisassembledJdbcValue
in interfaceEntityValuedModelPart
-
forEachJdbcValue
public <X,Y> int forEachJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> consumer, SharedSessionContractImplementor session)
Description copied from interface:Bindable
Visit each constituent JDBC value extracted from the entity instance itself. Short-hand form of callingBindable.disassemble(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor)
and piping its result toBindable.forEachDisassembledJdbcValue(Object, int, JdbcValuesConsumer, SharedSessionContractImplementor)
- Specified by:
forEachJdbcValue
in interfaceBindable
- Specified by:
forEachJdbcValue
in interfaceEntityValuedModelPart
-
-