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 ClassesModifier and TypeClassDescriptionstatic enumstatic classNested 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
ConstructorsModifierConstructorDescriptionToOneAttributeMapping(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) protectedToOneAttributeMapping(ToOneAttributeMapping original) For Hibernate Reactive -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddPrefixedPropertyNames(Set<String> targetKeyPropertyNames, String prefix, Type type, SessionFactoryImplementor factory) static voidaddPrefixedPropertyPaths(Set<String> targetKeyPropertyNames, String prefix, Type type, SessionFactoryImplementor factory) voidaddToCacheKey(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session) Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.voidapplySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState) Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.voidapplySqlSelections(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.protected EntityFetchbuildEntityDelayedFetch(FetchParent fetchParent, ToOneAttributeMapping fetchedAttribute, NavigablePath navigablePath, DomainResult<?> keyResult, boolean selectByUniqueKey, DomainResultCreationState creationState) For Hibernate Reactiveprotected EntityFetchbuildEntityFetchJoined(FetchParent fetchParent, ToOneAttributeMapping toOneMapping, TableGroup tableGroup, DomainResult<?> keyResult, boolean isAffectedByFilter, NavigablePath navigablePath, DomainResultCreationState creationState) For Hibernate Reactiveprotected EntityFetchbuildEntityFetchSelect(FetchParent fetchParent, ToOneAttributeMapping fetchedAttribute, NavigablePath navigablePath, DomainResult<?> keyResult, boolean selectByUniqueKey, boolean isAffectedByFilter, DomainResultCreationState creationState) For Hibernate ReactivebooleancanUseParentTableGroup(TableGroupProducer producer, NavigablePath navigablePath, ValuedModelPart valuedModelPart) booleancontainsTableReference(String tableExpression) copy(ManagedMappingType declaringType, TableGroupProducer declaringTableGroupProducer) 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.createTableGroupInternal(boolean canUseInnerJoins, NavigablePath navigablePath, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlAstCreationState creationState) createTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, @Nullable String explicitSourceAlias, @Nullable SqlAliasBase explicitSqlAliasBase, @Nullable SqlAstJoinType requestedJoinType, boolean fetched, boolean addsPredicate, SqlAstCreationState creationState) Create a TableGroupJoin.determineSqlJoinType(TableGroup lhs, @Nullable SqlAstJoinType requestedJoinType, boolean fetched) disassemble(Object value, SharedSessionContractImplementor session) Breaks down a value ofJinto its simple pieces.protected static ObjectextractAttributePathValue(Object domainValue, EntityMappingType entityType, String attributePath) protected ObjectextractValue(Object domainValue, SharedSessionContractImplementor session) findSubPart(String name) findSubPart(String name, EntityMappingType targetType) <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).intforEachJdbcType(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> consumer, SharedSessionContractImplementor session) Visit each constituent JDBC value extracted from the entity instance itself.intforEachSelectable(int offset, SelectableConsumer consumer) Visits each selectable mapping with the selectable index offset by the given value.generateFetch(FetchParent fetchParent, NavigablePath fetchablePath, FetchTiming fetchTiming, boolean selected, String resultVariable, DomainResultCreationState creationState) Generates a Fetch of this fetchableThe table which contains the columns mapped by this valuegetDefaultSqlAstJoinType(TableGroup parentTableGroup) The descriptor of the entity that is the type for this partgetFetchable(int position) The descriptor, allowing access to column(s), etcgetJdbcMapping(int index) intThe number of JDBC mappingsThe model sub-part relative to the associated entity type that is the target of this association's foreign-keyDescriptor for the type of this mappingintThe number of fetchables in the containergetSelectable(int columnIndex) Get the selectable at the given positionIndicates which "side" of the foreign-key this association describesGet the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedbooleanbooleanbooleanprotected booleanisBidirectionalAttributeName(NavigablePath parentNavigablePath, ModelPart parentModelPart, NavigablePath fetchablePath, DomainResultCreationState creationState) booleanbooleanbooleanbooleanisLazy()booleanbooleanbooleanbooleanisSimpleJoinPredicate(Predicate predicate) Returns whether the given predicate is a simple join predicate for this attribute.booleanprotected ObjectlazyInitialize(Object domainValue) For Hibernate Reactive, because it doesn't support lazy initialization, it will override this method and skip it when possible.resolveCircularFetch(NavigablePath fetchablePath, FetchParent fetchParent, FetchTiming fetchTiming, DomainResultCreationState creationState) Check whether this Fetchable is considered a circular fetch.voidsetForeignKeyDescriptor(ForeignKeyDescriptor foreignKeyDescriptor) voidsetIdentifyingColumnsTableExpression(String tableExpression) voidsetupCircularFetchModelPart(MappingModelCreationProcess creationProcess) toString()Methods inherited from class org.hibernate.metamodel.mapping.internal.AbstractSingularAttributeMapping
getGeneratorMethods inherited from class org.hibernate.metamodel.mapping.internal.AbstractStateArrayContributorMapping
getFetchableName, getMappedFetchOptions, getStyle, getTimingMethods inherited from class org.hibernate.metamodel.mapping.internal.AbstractAttributeMapping
getAttributeMetadata, getAttributeName, getDeclaringType, getFetchableKey, getJavaType, getPartMappingType, getPropertyAccess, getStateArrayPositionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.hibernate.metamodel.mapping.AttributeMapping
asAttributeMapping, asEmbeddedAttributeMapping, asPluralAttributeMapping, compare, findContainingEntityMapping, getAttributeMetadata, getAttributeName, getDeclaringType, getExposedMutabilityPlan, getPartName, getPropertyAccess, getStateArrayPosition, getValue, isEmbeddedAttributeMapping, isPluralAttributeMapping, setValueMethods inherited from interface org.hibernate.metamodel.mapping.Bindable
forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachJdbcValue, forEachJdbcValueMethods inherited from interface org.hibernate.metamodel.mapping.EntityAssociationMapping
getFetchableName, incrementFetchDepthMethods inherited from interface org.hibernate.metamodel.mapping.EntityValuedModelPart
createDomainResult, forEachSubPart, visitSubPartsMethods inherited from interface org.hibernate.sql.results.graph.Fetchable
getFetchableKey, getMappedFetchOptions, isSelectableMethods inherited from interface org.hibernate.sql.results.graph.FetchableContainer
getKeyFetchable, getNumberOfFetchableKeys, getNumberOfKeyFetchables, getSelectableIndex, visitFetchables, visitFetchables, visitFetchables, visitKeyFetchables, visitKeyFetchables, visitKeyFetchablesMethods inherited from interface org.hibernate.metamodel.mapping.ModelPart
areEqual, asBasicValuedModelPart, asEntityMappingType, breakDownJdbcValues, decompose, decompose, getJavaType, getPartMappingType, isEntityIdentifierMapping, isVirtualMethods inherited from interface org.hibernate.metamodel.mapping.ModelPartContainer
findByPath, findByPath, forEachSubPartMethods inherited from interface org.hibernate.metamodel.mapping.ValuedModelPart
forEachInsertable, forEachNonFormula, forEachSelectable, forEachUpdatable, getSingleJdbcMappingMethods inherited from interface org.hibernate.metamodel.mapping.ValueMapping
getExpressibleJavaType, treatAs
-
Constructor Details
-
ToOneAttributeMapping
For Hibernate Reactive
-
-
Method Details
-
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
-
setupCircularFetchModelPart
-
getIdentifyingColumnsTableExpression
-
setIdentifyingColumnsTableExpression
-
getForeignKeyDescriptor
Description copied from interface:AssociationThe descriptor, allowing access to column(s), etc- Specified by:
getForeignKeyDescriptorin interfaceAssociation
-
getSideNature
Description copied from interface:AssociationIndicates which "side" of the foreign-key this association describes- Specified by:
getSideNaturein interfaceAssociation
-
isReferenceToPrimaryKey
public boolean isReferenceToPrimaryKey()- Specified by:
isReferenceToPrimaryKeyin interfaceEntityAssociationMapping
-
isFkOptimizationAllowed
public boolean isFkOptimizationAllowed()- Specified by:
isFkOptimizationAllowedin interfaceEntityAssociationMapping
-
hasPartitionedSelectionMapping
public boolean hasPartitionedSelectionMapping()- Specified by:
hasPartitionedSelectionMappingin interfaceModelPart
-
getReferencedPropertyName
-
getTargetKeyPropertyName
-
getTargetKeyPropertyNames
- Specified by:
getTargetKeyPropertyNamesin interfaceEntityAssociationMapping
-
getCardinality
-
hasJoinTable
public boolean hasJoinTable() -
getMappedType
Description copied from interface:ValueMappingDescriptor for the type of this mapping- Specified by:
getMappedTypein interfaceValueMapping
-
getEntityMappingType
Description copied from interface:EntityValuedModelPartThe descriptor of the entity that is the type for this part- Specified by:
getEntityMappingTypein interfaceEntityValuedModelPart
-
findSubPart
- Specified by:
findSubPartin interfaceEntityValuedModelPart
-
findSubPart
- Specified by:
findSubPartin interfaceEntityValuedModelPart- Specified by:
findSubPartin interfaceModelPartContainer
-
getDefaultSqlAstJoinType
- Specified by:
getDefaultSqlAstJoinTypein interfaceTableGroupJoinProducer
-
isSimpleJoinPredicate
Description copied from interface:TableGroupJoinProducerReturns 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:
isSimpleJoinPredicatein interfaceTableGroupJoinProducer
-
containsTableReference
- Specified by:
containsTableReferencein interfaceTableGroupProducer
-
getNumberOfFetchables
public int getNumberOfFetchables()Description copied from interface:FetchableContainerThe number of fetchables in the container- Specified by:
getNumberOfFetchablesin interfaceFetchableContainer
-
getFetchable
- Specified by:
getFetchablein interfaceFetchableContainer
-
determineSqlJoinType
public SqlAstJoinType determineSqlJoinType(TableGroup lhs, @Nullable SqlAstJoinType requestedJoinType, boolean fetched) - Specified by:
determineSqlJoinTypein interfaceTableGroupJoinProducer
-
getSqlAliasStem
Description copied from interface:TableGroupProducerGet 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:
getSqlAliasStemin interfaceTableGroupProducer- See Also:
-
isNullable
public boolean isNullable() -
isLazy
public boolean isLazy() -
isOptional
public boolean isOptional()- Specified by:
isOptionalin interfaceEntityValuedFetchable
-
isInternalLoadNullable
public boolean isInternalLoadNullable() -
getNotFoundAction
-
isIgnoreNotFound
public boolean isIgnoreNotFound() -
hasNotFoundAction
public boolean hasNotFoundAction() -
isUnwrapProxy
public boolean isUnwrapProxy()- Specified by:
isUnwrapProxyin interfaceEntityValuedFetchable
-
getAssociatedEntityMappingType
- Specified by:
getAssociatedEntityMappingTypein interfaceEntityAssociationMapping
-
getKeyTargetMatchPart
Description copied from interface:EntityAssociationMappingThe model sub-part relative to the associated entity type that is the target of this association's foreign-key- Specified by:
getKeyTargetMatchPartin interfaceEntityAssociationMapping
-
toString
-
lazyInitialize
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
Description copied from interface:ModelPartVisits each selectable mapping with the selectable index offset by the given value. Returns the amount of jdbc types that have been visited.- Specified by:
forEachSelectablein interfaceModelPart- Specified by:
forEachSelectablein interfaceSelectableMappings- Specified by:
forEachSelectablein interfaceValuedModelPart- See Also:
-
getContainingTableExpression
Description copied from interface:ValuedModelPartThe table which contains the columns mapped by this value- Specified by:
getContainingTableExpressionin interfaceValuedModelPart
-
getJdbcTypeCount
public int getJdbcTypeCount()Description copied from interface:BindableThe number of JDBC mappings- Specified by:
getJdbcTypeCountin interfaceBindable- Specified by:
getJdbcTypeCountin interfaceEntityValuedModelPart- Specified by:
getJdbcTypeCountin interfaceJdbcMappingContainer- Specified by:
getJdbcTypeCountin interfaceSelectableMappings- Specified by:
getJdbcTypeCountin interfaceValuedModelPart
-
getJdbcMapping
- Specified by:
getJdbcMappingin interfaceJdbcMappingContainer
-
getSelectable
Description copied from interface:SelectableMappingsGet the selectable at the given position- Specified by:
getSelectablein interfaceSelectableMappings
-
forEachJdbcType
Description copied from interface:JdbcMappingContainerVisit each JdbcMapping starting from the given offset- Specified by:
forEachJdbcTypein interfaceEntityValuedModelPart- Specified by:
forEachJdbcTypein interfaceJdbcMappingContainer
-