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

public Class ToOneAttributeMapping

extends AbstractSingularAttributeMapping
implements EntityValuedFetchable, EntityAssociationMapping, TableGroupJoinProducer, ParentTableGroupUseChecker
Class Inheritance
All Implemented Interfaces
org.hibernate.sql.ast.tree.from.LazyTableGroup.ParentTableGroupUseChecker, org.hibernate.sql.ast.tree.from.TableGroupJoinProducer, 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, org.hibernate.metamodel.mapping.EntityAssociationMapping, org.hibernate.metamodel.mapping.Association, org.hibernate.sql.results.graph.Fetchable, org.hibernate.sql.results.graph.entity.EntityValuedFetchable, org.hibernate.metamodel.mapping.EntityValuedModelPart, org.hibernate.sql.results.graph.FetchableContainer
Imports
java.util.Arrays, .HashSet, .List, .Locale, .Set, java.util.function.BiConsumer, .Consumer, .Supplier, org.hibernate.AssertionFailure, .LockMode, org.hibernate.annotations.NotFoundAction, org.hibernate.cache.MutableCacheKeyBuilder, org.hibernate.engine.FetchStyle, .FetchTiming, org.hibernate.engine.spi.SessionFactoryImplementor, .SharedSessionContractImplementor, org.hibernate.internal.util.IndexedConsumer, org.hibernate.internal.util.collections.ArrayHelper, org.hibernate.mapping.Collection, .Component, .Join, .ManyToOne, .OneToOne, .PersistentClass, .Property, .Selectable, .ToOne, .Value, org.hibernate.metamodel.UnsupportedMappingException, org.hibernate.metamodel.mapping.AssociationKey, .AttributeMapping, .AttributeMetadata, .CollectionPart, .EmbeddableValuedModelPart, .EntityAssociationMapping, .EntityIdentifierMapping, .EntityMappingType, .ForeignKeyDescriptor, .JdbcMapping, .ManagedMappingType, .MappingType, .ModelPart, .ModelPartContainer, .PluralAttributeMapping, .SelectableConsumer, .SelectableMapping, .SelectablePath, .SoftDeleteMapping, .ValuedModelPart, .VirtualModelPart, org.hibernate.metamodel.model.domain.NavigableRole, org.hibernate.persister.collection.AbstractCollectionPersister, org.hibernate.persister.entity.AbstractEntityPersister, .EntityPersister, org.hibernate.property.access.spi.PropertyAccess, org.hibernate.spi.EntityIdentifierNavigablePath, .NavigablePath, .TreatedNavigablePath, org.hibernate.sql.ast.SqlAstJoinType, org.hibernate.sql.ast.spi.FromClauseAccess, .SqlAliasBase, .SqlAliasStemHelper, .SqlAstCreationState, .SqlSelection, org.hibernate.sql.ast.tree.from.CorrelatedTableGroup, .LazyTableGroup, .MappedByTableGroup, .PluralTableGroup, .StandardTableGroup, .TableGroup, .TableGroupJoin, .TableGroupJoinProducer, .TableGroupProducer, .TableReference, .TableReferenceJoin, org.hibernate.sql.ast.tree.predicate.Predicate, org.hibernate.sql.results.graph.AssemblerCreationState, .DomainResult, .DomainResultAssembler, .DomainResultCreationState, .Fetch, .FetchOptions, .FetchParent, .FetchParentAccess, .Fetchable, org.hibernate.sql.results.graph.embeddable.EmbeddableValuedFetchable, org.hibernate.sql.results.graph.entity.EntityFetch, .EntityValuedFetchable, org.hibernate.sql.results.graph.entity.internal.EntityDelayedFetchImpl, .EntityFetchJoinedImpl, .EntityFetchSelectImpl, .EntityResultJoinedSubclassImpl, org.hibernate.sql.results.internal.NullValueAssembler, org.hibernate.sql.results.internal.domain.CircularBiDirectionalFetchImpl, .CircularFetchImpl, org.hibernate.type.ComponentType, .CompositeType, .EmbeddedComponentType, .EntityType, .Type, org.hibernate.type.descriptor.java.JavaType

Author
Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
public static class

Field Summary

Modifier and TypeField and Description
private final SelectablePath
private boolean
private final ToOneAttributeMapping.Cardinality
private final TableGroupProducer
private final EntityMappingType
private ForeignKeyDescriptor
private final boolean
private String
private final boolean
private final boolean
private final boolean
private final boolean
private final NotFoundAction
private final String
private ForeignKeyDescriptor.Nature
private final String
private final String
private final Set<String>
private final boolean

Constructor Summary

AccessConstructor and Description
protected
ToOneAttributeMapping(ToOneAttributeMapping original)

For Hibernate Reactive

public
ToOneAttributeMapping(String name, NavigableRole navigableRole, int stateArrayPosition, int fetchableIndex, ToOne bootValue, AttributeMetadata attributeMetadata, FetchOptions mappedFetchOptions, EntityMappingType entityMappingType, ManagedMappingType declaringType, EntityPersister declaringEntityPersister, PropertyAccess propertyAccess)

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)

private
ToOneAttributeMapping(ToOneAttributeMapping original, ManagedMappingType declaringType, TableGroupProducer declaringTableGroupProducer)

Method Summary

Modifier and TypeMethod and Description
public static void
addPrefixedPropertyNames(Set<String> targetKeyPropertyNames, String prefix, Type type, SessionFactoryImplementor factory)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
public static void
addPrefixedPropertyPaths(Set<String> targetKeyPropertyNames, String prefix, Type type, SessionFactoryImplementor factory)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
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
)

Overrides default org.hibernate.metamodel.mapping.EntityValuedModelPart.addToCacheKey.

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.
private static FetchTiming
adjustFetchTiming(FetchTiming mappedFetchTiming, ToOne bootValue)

public void
applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState)

Overrides default org.hibernate.metamodel.mapping.EntityValuedModelPart.applySqlSelections.

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)

Overrides default org.hibernate.metamodel.mapping.EntityValuedModelPart.applySqlSelections.

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.
protected EntityFetch
buildEntityDelayedFetch(FetchParent fetchParent, ToOneAttributeMapping fetchedAttribute, NavigablePath navigablePath, DomainResult<?> keyResult, boolean selectByUniqueKey)

For Hibernate Reactive

protected EntityFetch
buildEntityFetchJoined(FetchParent fetchParent, ToOneAttributeMapping toOneMapping, TableGroup tableGroup, DomainResult<?> keyResult, NavigablePath navigablePath, DomainResultCreationState creationState)

For Hibernate Reactive

protected EntityFetch
buildEntityFetchSelect(FetchParent fetchParent, ToOneAttributeMapping fetchedAttribute, NavigablePath navigablePath, DomainResult<?> keyResult, boolean selectByUniqueKey, DomainResultCreationState creationState)

For Hibernate Reactive

public boolean
public boolean
public ToOneAttributeMapping
copy(ManagedMappingType declaringType, TableGroupProducer declaringTableGroupProducer)

private Fetch
createCircularBiDirectionalFetch(NavigablePath fetchablePath, FetchParent fetchParent, NavigablePath parentNavigablePath, FetchTiming fetchTiming, DomainResultCreationState creationState)

public LazyTableGroup
createRootTableGroupJoin(NavigablePath
The NavigablePath to the join
navigablePath
,
TableGroup
The join's (L)eft-(H)and (S)ide
lhs
,
String explicitSourceAlias, SqlAliasBase
A specific SqlAliasBase to use. May be null indicating one should be created using the SqlAliasBaseGenerator from creationState
explicitSqlAliasBase
,
SqlAstJoinType
An explicit join-type. May be null to signal that the join is for an implicit path.
requestedJoinType
,
boolean fetched, Consumer<Predicate>
Consumer for additional predicates from the producer's mapping.
predicateConsumer
,
SqlAstCreationState creationState)

Implements org.hibernate.sql.ast.tree.from.TableGroupJoinProducer.createRootTableGroupJoin.

Create the "join", but return a TableGroup.
public <T> DomainResult<T>
createSnapshotDomainResult(NavigablePath navigablePath, TableGroup parentTableGroup, String resultVariable, DomainResultCreationState creationState)

Overrides default org.hibernate.sql.results.graph.DatabaseSnapshotContributor.createSnapshotDomainResult.

Create a DomainResult to be used when selecting snapshots from the database.
private TableGroup
createTableGroupForDelayedFetch(NavigablePath fetchablePath, TableGroup parentTableGroup, String resultVariable, DomainResultCreationState creationState)

public TableGroup
createTableGroupInternal(boolean canUseInnerJoins, NavigablePath navigablePath, boolean fetched, String sourceAlias, final SqlAliasBase sqlAliasBase, SqlAstCreationState creationState)

public TableGroupJoin
createTableGroupJoin(NavigablePath
The NavigablePath to the join
navigablePath
,
TableGroup
The join's (L)eft-(H)and (S)ide
lhs
,
String explicitSourceAlias, SqlAliasBase
A specific SqlAliasBase to use. May be null indicating one should be created using the SqlAliasBaseGenerator from creationState
explicitSqlAliasBase
,
SqlAstJoinType
An explicit join-type. May be null to signal that the join is for an implicit path.
requestedJoinType
,
boolean fetched, boolean
Indicates there are explicit, additional predicates (from an SQM tree ON/WITH clause)
addsPredicate
,
SqlAstCreationState creationState)

Implements org.hibernate.sql.ast.tree.from.TableGroupJoinProducer.createTableGroupJoin.

Create a TableGroupJoin.
public SqlAstJoinType
private TableGroup
determineTableGroupForFetch(NavigablePath fetchablePath, FetchParent fetchParent, TableGroup parentTableGroup, String resultVariable, FromClauseAccess fromClauseAccess, DomainResultCreationState creationState)

public Object
private static boolean
equal(Value lhsValue, Value rhsValue)

private static Object
extractAttributePathValue(Object domainValue, EntityMappingType entityType, String attributePath)

private Object
private static SelectablePath
findBidirectionalOneToManyAttributeName(String propertyPath, ManagedMappingType declaringType, SelectablePath parentSelectablePath, Collection<Property> properties)

private SelectablePath
findBidirectionalOneToOneAttributeName(String propertyPath, ManagedMappingType declaringType, SelectablePath parentSelectablePath, Collection<Property> properties)

pack-priv static String
findMapsIdPropertyName(EntityMappingType entityMappingType, String referencedPropertyName)

public ModelPart
public ModelPart
public <X, Y> int
public int
public <X, Y> int
forEachJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X, Y> consumer, SharedSessionContractImplementor session)

Overrides default org.hibernate.metamodel.mapping.Bindable.forEachJdbcValue, org.hibernate.metamodel.mapping.EntityValuedModelPart.forEachJdbcValue.

Visit each constituent JDBC value extracted from the entity instance itself.
public int
forEachSelectable(int offset, SelectableConsumer consumer)

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

Visits each selectable mapping with the selectable index offset by the given value.
public EntityFetch
generateFetch(FetchParent
The parent of the Fetch we are generating
fetchParent
,
NavigablePath
The overall path within the graph
fetchablePath
,
FetchTiming
The requested fetch timing
fetchTiming
,
boolean selected, String resultVariable, DomainResultCreationState creationState)

Implements org.hibernate.sql.results.graph.entity.EntityValuedFetchable.generateFetch, org.hibernate.sql.results.graph.Fetchable.generateFetch.

Generates a Fetch of this fetchable
public EntityMappingType
public ToOneAttributeMapping.Cardinality
public String
getContainingTableExpression()

Implements org.hibernate.metamodel.mapping.ValuedModelPart.getContainingTableExpression.

The table which contains the columns mapped by this value
public SqlAstJoinType
public EntityMappingType
getEntityMappingType()

Implements org.hibernate.metamodel.mapping.EntityValuedModelPart.getEntityMappingType.

The descriptor of the entity that is the type for this part
public Fetchable
public ForeignKeyDescriptor
getForeignKeyDescriptor()

Implements org.hibernate.metamodel.mapping.Association.getForeignKeyDescriptor.

The descriptor, allowing access to column(s), etc
public String
public JdbcMapping
public int
private SqlAstJoinType
getJoinTypeForFetch(NavigablePath navigablePath, TableGroup tableGroup)

public ModelPart
getKeyTargetMatchPart()

Implements org.hibernate.metamodel.mapping.EntityAssociationMapping.getKeyTargetMatchPart.

The model sub-part relative to the associated entity type that is the target of this association's foreign-key
public EntityMappingType
getMappedType()

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

Descriptor for the type of this mapping
public NavigableRole
public NotFoundAction
public int
private NavigablePath
public String
public SelectableMapping
getSelectable(int columnIndex)

Implements org.hibernate.metamodel.mapping.SelectableMappings.getSelectable.

Get the selectable at the given position
public ForeignKeyDescriptor.Nature
getSideNature()

Implements org.hibernate.metamodel.mapping.Association.getSideNature.

Indicates which "side" of the foreign-key this association describes
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 String
public Set<String>
public boolean
public boolean
private void
initializeIfNeeded(TableGroup lhs, SqlAstJoinType sqlAstJoinType, TableGroup tableGroup)

protected boolean
isBidirectionalAttributeName(NavigablePath parentNavigablePath, ModelPart parentModelPart, NavigablePath fetchablePath, DomainResultCreationState creationState)

public boolean
public boolean
public boolean
public boolean
public boolean
private boolean
public boolean
private boolean
public boolean
isSimpleJoinPredicate(Predicate predicate)

Implements org.hibernate.sql.ast.tree.from.TableGroupJoinProducer.isSimpleJoinPredicate.

Returns whether the given predicate is a simple join predicate for this attribute.
public boolean
public Fetch
resolveCircularFetch(NavigablePath
The overall path within the graph
fetchablePath
,
FetchParent fetchParent, FetchTiming fetchTiming, DomainResultCreationState creationState)

Overrides default org.hibernate.sql.results.graph.Fetchable.resolveCircularFetch.

Check whether this Fetchable is considered a circular fetch.
private static TableGroupProducer
resolveDeclaringTableGroupProducer(EntityPersister declaringEntityPersister, NavigableRole navigableRole)

public void
public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
private EntityFetch
Inherited from org.hibernate.metamodel.mapping.internal.AbstractSingularAttributeMapping:
getGeneratorgetPropertyAccess