renamed `SingularAssociationAttributeMapping` to `ToOneAttributeMapping`

This commit is contained in:
Steve Ebersole 2020-05-29 14:33:52 -05:00
parent b06c341d8a
commit d3f6f46980
19 changed files with 72 additions and 81 deletions

View File

@ -27,7 +27,7 @@ import org.hibernate.mapping.Component;
import org.hibernate.mapping.Property; import org.hibernate.mapping.Property;
import org.hibernate.metamodel.mapping.internal.MappingModelCreationHelper; import org.hibernate.metamodel.mapping.internal.MappingModelCreationHelper;
import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess; import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess;
import org.hibernate.metamodel.mapping.internal.SingularAssociationAttributeMapping; import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.metamodel.model.domain.NavigableRole; import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy; import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext; import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
@ -224,7 +224,7 @@ public class EmbeddableMappingType implements ManagedMappingType {
); );
} }
else if ( subtype instanceof EntityType ) { else if ( subtype instanceof EntityType ) {
final SingularAssociationAttributeMapping singularAssociationAttributeMapping = MappingModelCreationHelper.buildSingularAssociationAttributeMapping( final ToOneAttributeMapping toOneAttributeMapping = MappingModelCreationHelper.buildSingularAssociationAttributeMapping(
bootPropertyDescriptor.getName(), bootPropertyDescriptor.getName(),
valueMapping.getNavigableRole().append( bootPropertyDescriptor.getName() ), valueMapping.getNavigableRole().append( bootPropertyDescriptor.getName() ),
attributeIndex, attributeIndex,
@ -235,7 +235,7 @@ public class EmbeddableMappingType implements ManagedMappingType {
compositeType.getCascadeStyle( attributeIndex ), compositeType.getCascadeStyle( attributeIndex ),
creationProcess creationProcess
); );
attributeMappings.put( bootPropertyDescriptor.getName(), singularAssociationAttributeMapping ); attributeMappings.put( bootPropertyDescriptor.getName(), toOneAttributeMapping );
// todo (6.0) : not sure it is always correct // todo (6.0) : not sure it is always correct
columnPosition++; columnPosition++;
} }

View File

@ -67,8 +67,8 @@ public class EmbeddedForeignKeyDescriptor implements ForeignKeyDescriptor, Model
attribute -> { attribute -> {
final TypeConfiguration typeConfiguration = creationProcess.getCreationContext() final TypeConfiguration typeConfiguration = creationProcess.getCreationContext()
.getTypeConfiguration(); .getTypeConfiguration();
if ( attribute instanceof SingularAssociationAttributeMapping ) { if ( attribute instanceof ToOneAttributeMapping ) {
SingularAssociationAttributeMapping associationAttributeMapping = (SingularAssociationAttributeMapping) attribute; ToOneAttributeMapping associationAttributeMapping = (ToOneAttributeMapping) attribute;
associationAttributeMapping.getAssociatedEntityMappingType() associationAttributeMapping.getAssociatedEntityMappingType()
.getEntityPersister() .getEntityPersister()
.getIdentifierMapping() .getIdentifierMapping()

View File

@ -172,9 +172,9 @@ public class EmbeddedIdentifierMappingImpl implements CompositeIdentifierMapping
getEmbeddableTypeDescriptor().getAttributeMappings().forEach( getEmbeddableTypeDescriptor().getAttributeMappings().forEach(
attributeMapping -> { attributeMapping -> {
final Object o = attributeMapping.getPropertyAccess().getGetter().get( value ); final Object o = attributeMapping.getPropertyAccess().getGetter().get( value );
if ( attributeMapping instanceof SingularAssociationAttributeMapping ) { if ( attributeMapping instanceof ToOneAttributeMapping ) {
final EntityMappingType associatedEntityMappingType = final EntityMappingType associatedEntityMappingType =
( (SingularAssociationAttributeMapping) attributeMapping ).getAssociatedEntityMappingType(); ( (ToOneAttributeMapping) attributeMapping ).getAssociatedEntityMappingType();
final EntityIdentifierMapping identifierMapping = final EntityIdentifierMapping identifierMapping =
associatedEntityMappingType.getIdentifierMapping(); associatedEntityMappingType.getIdentifierMapping();
final Object identifier = identifierMapping.getIdentifier( o, session ); final Object identifier = identifierMapping.getIdentifier( o, session );
@ -318,8 +318,8 @@ public class EmbeddedIdentifierMappingImpl implements CompositeIdentifierMapping
public void visitColumns(ColumnConsumer consumer) { public void visitColumns(ColumnConsumer consumer) {
getAttributes().forEach( getAttributes().forEach(
attribute -> { attribute -> {
if ( attribute instanceof SingularAssociationAttributeMapping ) { if ( attribute instanceof ToOneAttributeMapping ) {
final SingularAssociationAttributeMapping associationAttributeMapping = (SingularAssociationAttributeMapping) attribute; final ToOneAttributeMapping associationAttributeMapping = (ToOneAttributeMapping) attribute;
associationAttributeMapping.getForeignKeyDescriptor().visitReferringColumns( consumer ); associationAttributeMapping.getForeignKeyDescriptor().visitReferringColumns( consumer );
} }
else { else {

View File

@ -833,8 +833,8 @@ public class MappingModelCreationHelper {
attributeMappingSubPart = attributeMapping.findSubPart( collectionDescriptor.getMappedByProperty(), null ); attributeMappingSubPart = attributeMapping.findSubPart( collectionDescriptor.getMappedByProperty(), null );
} }
if ( attributeMappingSubPart != null && attributeMappingSubPart instanceof SingularAssociationAttributeMapping ) { if ( attributeMappingSubPart != null && attributeMappingSubPart instanceof ToOneAttributeMapping ) {
final SingularAssociationAttributeMapping referencedAttributeMapping = (SingularAssociationAttributeMapping) attributeMappingSubPart; final ToOneAttributeMapping referencedAttributeMapping = (ToOneAttributeMapping) attributeMappingSubPart;
setRefererencedAttributeForeignKeyDescriptor( setRefererencedAttributeForeignKeyDescriptor(
attributeMapping, attributeMapping,
@ -892,7 +892,7 @@ public class MappingModelCreationHelper {
} }
public static void interpretSingularAssociationAttributeMappingKeyDescriptor( public static void interpretSingularAssociationAttributeMappingKeyDescriptor(
SingularAssociationAttributeMapping attributeMapping, ToOneAttributeMapping attributeMapping,
Property bootProperty, Property bootProperty,
ToOne bootValueMapping, ToOne bootValueMapping,
EntityMappingType declaringEntityDescriptor, EntityMappingType declaringEntityDescriptor,
@ -915,8 +915,8 @@ public class MappingModelCreationHelper {
} }
if ( referencedPropertyName != null ) { if ( referencedPropertyName != null ) {
final SingularAssociationAttributeMapping referencedAttributeMapping = final ToOneAttributeMapping referencedAttributeMapping =
(SingularAssociationAttributeMapping) referencedEntityDescriptor.findSubPart( referencedPropertyName ); (ToOneAttributeMapping) referencedEntityDescriptor.findSubPart( referencedPropertyName );
setRefererencedAttributeForeignKeyDescriptor( setRefererencedAttributeForeignKeyDescriptor(
attributeMapping, attributeMapping,
@ -1006,7 +1006,7 @@ public class MappingModelCreationHelper {
private static void setRefererencedAttributeForeignKeyDescriptor( private static void setRefererencedAttributeForeignKeyDescriptor(
AbstractAttributeMapping attributeMapping, AbstractAttributeMapping attributeMapping,
SingularAssociationAttributeMapping referencedAttributeMapping, ToOneAttributeMapping referencedAttributeMapping,
EntityPersister referencedEntityDescriptor, EntityPersister referencedEntityDescriptor,
String referencedPropertyName, String referencedPropertyName,
Dialect dialect, Dialect dialect,
@ -1253,7 +1253,7 @@ public class MappingModelCreationHelper {
} }
} }
public static SingularAssociationAttributeMapping buildSingularAssociationAttributeMapping( public static ToOneAttributeMapping buildSingularAssociationAttributeMapping(
String attrName, String attrName,
NavigableRole navigableRole, NavigableRole navigableRole,
int stateArrayPosition, int stateArrayPosition,
@ -1296,7 +1296,7 @@ public class MappingModelCreationHelper {
final FetchStrategy fetchStrategy = new FetchStrategy( fetchTiming, fetchStyle ); final FetchStrategy fetchStrategy = new FetchStrategy( fetchTiming, fetchStyle );
final SingularAssociationAttributeMapping attributeMapping = new SingularAssociationAttributeMapping( final ToOneAttributeMapping attributeMapping = new ToOneAttributeMapping(
attrName, attrName,
navigableRole, navigableRole,
stateArrayPosition, stateArrayPosition,

View File

@ -55,7 +55,7 @@ import org.hibernate.type.ForeignKeyDirection;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class SingularAssociationAttributeMapping extends AbstractSingularAttributeMapping public class ToOneAttributeMapping extends AbstractSingularAttributeMapping
implements EntityValuedFetchable, EntityAssociationMapping, Association, TableGroupJoinProducer { implements EntityValuedFetchable, EntityAssociationMapping, Association, TableGroupJoinProducer {
public enum Cardinality { public enum Cardinality {
@ -80,7 +80,7 @@ public class SingularAssociationAttributeMapping extends AbstractSingularAttribu
private ForeignKeyDirection foreignKeyDirection; private ForeignKeyDirection foreignKeyDirection;
private String identifyingColumnsTableExpression; private String identifyingColumnsTableExpression;
public SingularAssociationAttributeMapping( public ToOneAttributeMapping(
String name, String name,
NavigableRole navigableRole, NavigableRole navigableRole,
int stateArrayPosition, int stateArrayPosition,
@ -209,8 +209,8 @@ public class SingularAssociationAttributeMapping extends AbstractSingularAttribu
// while the getIdentifyingColumnExpressions for this association is PARENT_CHILD.child_id // while the getIdentifyingColumnExpressions for this association is PARENT_CHILD.child_id
// so we will check if the parentAssociation ForeignKey Target match with the association entity identifier table and columns // so we will check if the parentAssociation ForeignKey Target match with the association entity identifier table and columns
final ForeignKeyDescriptor associationParentForeignKeyDescriptor = associationParent.getForeignKeyDescriptor(); final ForeignKeyDescriptor associationParentForeignKeyDescriptor = associationParent.getForeignKeyDescriptor();
if ( referencedModePart instanceof SingularAssociationAttributeMapping if ( referencedModePart instanceof ToOneAttributeMapping
&& ( (SingularAssociationAttributeMapping) referencedModePart ).getDeclaringType() == getPartMappingType() ) { && ( (ToOneAttributeMapping) referencedModePart ).getDeclaringType() == getPartMappingType() ) {
if ( this.foreignKeyDescriptor.getReferringTableExpression() if ( this.foreignKeyDescriptor.getReferringTableExpression()
.equals( associationParentForeignKeyDescriptor.getReferringTableExpression() ) ) { .equals( associationParentForeignKeyDescriptor.getReferringTableExpression() ) ) {
final SingleTableEntityPersister entityPersister = (SingleTableEntityPersister) getDeclaringType(); final SingleTableEntityPersister entityPersister = (SingleTableEntityPersister) getDeclaringType();

View File

@ -76,7 +76,6 @@ import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.spi.CachedNaturalIdValueSource; import org.hibernate.engine.spi.CachedNaturalIdValueSource;
import org.hibernate.engine.spi.CascadeStyle; import org.hibernate.engine.spi.CascadeStyle;
import org.hibernate.engine.spi.CascadeStyles;
import org.hibernate.engine.spi.CollectionKey; import org.hibernate.engine.spi.CollectionKey;
import org.hibernate.engine.spi.EntityEntry; import org.hibernate.engine.spi.EntityEntry;
import org.hibernate.engine.spi.EntityEntryFactory; import org.hibernate.engine.spi.EntityEntryFactory;
@ -151,7 +150,7 @@ import org.hibernate.metamodel.mapping.internal.EntityVersionMappingImpl;
import org.hibernate.metamodel.mapping.internal.InFlightEntityMappingType; import org.hibernate.metamodel.mapping.internal.InFlightEntityMappingType;
import org.hibernate.metamodel.mapping.internal.MappingModelCreationHelper; import org.hibernate.metamodel.mapping.internal.MappingModelCreationHelper;
import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess; import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess;
import org.hibernate.metamodel.mapping.internal.SingularAssociationAttributeMapping; import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.metamodel.model.domain.NavigableRole; import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.metamodel.spi.EntityRepresentationStrategy; import org.hibernate.metamodel.spi.EntityRepresentationStrategy;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext; import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
@ -169,7 +168,6 @@ import org.hibernate.query.ComparisonOperator;
import org.hibernate.query.NavigablePath; import org.hibernate.query.NavigablePath;
import org.hibernate.query.sqm.mutation.internal.SqmMutationStrategyHelper; import org.hibernate.query.sqm.mutation.internal.SqmMutationStrategyHelper;
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy; import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
import org.hibernate.query.sqm.sql.SqmToSqlAstConverter;
import org.hibernate.sql.Alias; import org.hibernate.sql.Alias;
import org.hibernate.sql.Delete; import org.hibernate.sql.Delete;
import org.hibernate.sql.Insert; import org.hibernate.sql.Insert;
@ -211,7 +209,6 @@ import org.hibernate.tuple.ValueGeneration;
import org.hibernate.tuple.entity.EntityBasedAssociationAttribute; import org.hibernate.tuple.entity.EntityBasedAssociationAttribute;
import org.hibernate.tuple.entity.EntityMetamodel; import org.hibernate.tuple.entity.EntityMetamodel;
import org.hibernate.tuple.entity.EntityTuplizer; import org.hibernate.tuple.entity.EntityTuplizer;
import org.hibernate.type.AnyType;
import org.hibernate.type.AssociationType; import org.hibernate.type.AssociationType;
import org.hibernate.type.BasicType; import org.hibernate.type.BasicType;
import org.hibernate.type.CollectionType; import org.hibernate.type.CollectionType;
@ -6181,7 +6178,7 @@ public abstract class AbstractEntityPersister
); );
} }
else if ( attrType instanceof EntityType ) { else if ( attrType instanceof EntityType ) {
SingularAssociationAttributeMapping attributeMapping = MappingModelCreationHelper.buildSingularAssociationAttributeMapping( ToOneAttributeMapping attributeMapping = MappingModelCreationHelper.buildSingularAssociationAttributeMapping(
attrName, attrName,
getNavigableRole().append( attrName ), getNavigableRole().append( attrName ),
stateArrayPosition, stateArrayPosition,

View File

@ -10,6 +10,7 @@ import java.util.List;
import org.hibernate.metamodel.mapping.Association; import org.hibernate.metamodel.mapping.Association;
import org.hibernate.metamodel.mapping.ModelPart; import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.query.NavigablePath; import org.hibernate.query.NavigablePath;
/** /**
@ -44,7 +45,7 @@ public interface FetchParent extends DomainResultGraphNode {
* referenced container type, this method returns the referenced part. * referenced container type, this method returns the referenced part.
* *
* E.g. for a many-to-one this methods returns the * E.g. for a many-to-one this methods returns the
* {@link org.hibernate.metamodel.mapping.internal.SingularAssociationAttributeMapping} while * {@link ToOneAttributeMapping} while
* {@link #getReferencedMappingContainer} and {@link #getReferencedMappingType} return the referenced * {@link #getReferencedMappingContainer} and {@link #getReferencedMappingType} return the referenced
* {@link org.hibernate.metamodel.mapping.EntityMappingType}. * {@link org.hibernate.metamodel.mapping.EntityMappingType}.
*/ */

View File

@ -15,7 +15,7 @@ import org.hibernate.metamodel.mapping.BasicValuedModelPart;
import org.hibernate.metamodel.mapping.EmbeddableMappingType; import org.hibernate.metamodel.mapping.EmbeddableMappingType;
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart; import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
import org.hibernate.metamodel.mapping.EntityMappingType; import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.mapping.internal.SingularAssociationAttributeMapping; import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.query.NavigablePath; import org.hibernate.query.NavigablePath;
import org.hibernate.sql.ast.spi.SqlSelection; import org.hibernate.sql.ast.spi.SqlSelection;
import org.hibernate.sql.results.graph.AbstractFetchParent; import org.hibernate.sql.results.graph.AbstractFetchParent;
@ -66,19 +66,19 @@ public class EmbeddableForeignKeyResultImpl<T>
DomainResultCreationState creationState, DomainResultCreationState creationState,
MutableInteger mutableInteger, MutableInteger mutableInteger,
Fetchable fetchable) { Fetchable fetchable) {
if ( fetchable instanceof SingularAssociationAttributeMapping ) { if ( fetchable instanceof ToOneAttributeMapping ) {
final SingularAssociationAttributeMapping singularAssociationAttributeMapping = (SingularAssociationAttributeMapping) fetchable; final ToOneAttributeMapping toOneAttributeMapping = (ToOneAttributeMapping) fetchable;
EntityMappingType associatedEntityMappingType = singularAssociationAttributeMapping.getAssociatedEntityMappingType(); EntityMappingType associatedEntityMappingType = toOneAttributeMapping.getAssociatedEntityMappingType();
BasicResult domainResult = new BasicResult( BasicResult domainResult = new BasicResult(
sqlSelections.get( mutableInteger.getAndIncrement() ).getValuesArrayPosition(), sqlSelections.get( mutableInteger.getAndIncrement() ).getValuesArrayPosition(),
null, null,
associatedEntityMappingType.getIdentifierMapping().getJavaTypeDescriptor() associatedEntityMappingType.getIdentifierMapping().getJavaTypeDescriptor()
); );
Fetch fetch; Fetch fetch;
if ( singularAssociationAttributeMapping.getMappedFetchStrategy().getTiming() == FetchTiming.DELAYED ) { if ( toOneAttributeMapping.getMappedFetchStrategy().getTiming() == FetchTiming.DELAYED ) {
fetch = new EntityFetchDelayedImpl( fetch = new EntityFetchDelayedImpl(
this, this,
singularAssociationAttributeMapping, toOneAttributeMapping,
null, null,
false, false,
navigablePath.append( fetchable.getFetchableName() ), navigablePath.append( fetchable.getFetchableName() ),
@ -88,7 +88,7 @@ public class EmbeddableForeignKeyResultImpl<T>
else { else {
fetch = new EntityFetchSelectImpl( fetch = new EntityFetchSelectImpl(
this, this,
singularAssociationAttributeMapping, toOneAttributeMapping,
null, null,
false, false,
navigablePath.append( fetchable.getFetchableName() ), navigablePath.append( fetchable.getFetchableName() ),

View File

@ -8,7 +8,7 @@ package org.hibernate.sql.results.graph.entity.internal;
import org.hibernate.LockMode; import org.hibernate.LockMode;
import org.hibernate.engine.FetchTiming; import org.hibernate.engine.FetchTiming;
import org.hibernate.metamodel.mapping.internal.SingularAssociationAttributeMapping; import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.query.NavigablePath; import org.hibernate.query.NavigablePath;
import org.hibernate.sql.results.graph.AssemblerCreationState; import org.hibernate.sql.results.graph.AssemblerCreationState;
import org.hibernate.sql.results.graph.DomainResult; import org.hibernate.sql.results.graph.DomainResult;
@ -29,7 +29,7 @@ public class EntityFetchDelayedImpl extends AbstractNonJoinedEntityFetch {
public EntityFetchDelayedImpl( public EntityFetchDelayedImpl(
FetchParent fetchParent, FetchParent fetchParent,
SingularAssociationAttributeMapping fetchedAttribute, ToOneAttributeMapping fetchedAttribute,
LockMode lockMode, LockMode lockMode,
boolean nullable, boolean nullable,
NavigablePath navigablePath, NavigablePath navigablePath,

View File

@ -8,7 +8,7 @@ package org.hibernate.sql.results.graph.entity.internal;
import org.hibernate.LockMode; import org.hibernate.LockMode;
import org.hibernate.engine.FetchTiming; import org.hibernate.engine.FetchTiming;
import org.hibernate.metamodel.mapping.internal.SingularAssociationAttributeMapping; import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.query.NavigablePath; import org.hibernate.query.NavigablePath;
import org.hibernate.sql.results.graph.AssemblerCreationState; import org.hibernate.sql.results.graph.AssemblerCreationState;
import org.hibernate.sql.results.graph.DomainResult; import org.hibernate.sql.results.graph.DomainResult;
@ -29,7 +29,7 @@ public class EntityFetchSelectImpl extends AbstractNonJoinedEntityFetch {
public EntityFetchSelectImpl( public EntityFetchSelectImpl(
FetchParent fetchParent, FetchParent fetchParent,
SingularAssociationAttributeMapping fetchedAttribute, ToOneAttributeMapping fetchedAttribute,
LockMode lockMode, LockMode lockMode,
boolean nullable, boolean nullable,
NavigablePath navigablePath, NavigablePath navigablePath,

View File

@ -7,7 +7,6 @@
package org.hibernate.sql.results.graph.entity.internal; package org.hibernate.sql.results.graph.entity.internal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.function.Consumer;
import org.hibernate.LockMode; import org.hibernate.LockMode;
import org.hibernate.metamodel.mapping.EntityDiscriminatorMapping; import org.hibernate.metamodel.mapping.EntityDiscriminatorMapping;
@ -17,7 +16,7 @@ import org.hibernate.metamodel.mapping.EntityValuedModelPart;
import org.hibernate.metamodel.mapping.EntityVersionMapping; import org.hibernate.metamodel.mapping.EntityVersionMapping;
import org.hibernate.metamodel.mapping.ManagedMappingType; import org.hibernate.metamodel.mapping.ManagedMappingType;
import org.hibernate.metamodel.mapping.internal.SingleAttributeIdentifierMapping; import org.hibernate.metamodel.mapping.internal.SingleAttributeIdentifierMapping;
import org.hibernate.metamodel.mapping.internal.SingularAssociationAttributeMapping; import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.query.NavigablePath; import org.hibernate.query.NavigablePath;
import org.hibernate.sql.ast.tree.from.TableGroup; import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.results.graph.AbstractFetchParent; import org.hibernate.sql.results.graph.AbstractFetchParent;
@ -26,7 +25,6 @@ import org.hibernate.sql.results.graph.DomainResult;
import org.hibernate.sql.results.graph.DomainResultAssembler; import org.hibernate.sql.results.graph.DomainResultAssembler;
import org.hibernate.sql.results.graph.DomainResultCreationState; import org.hibernate.sql.results.graph.DomainResultCreationState;
import org.hibernate.sql.results.graph.FetchableContainer; import org.hibernate.sql.results.graph.FetchableContainer;
import org.hibernate.sql.results.graph.Initializer;
import org.hibernate.sql.results.graph.entity.EntityInitializer; import org.hibernate.sql.results.graph.entity.EntityInitializer;
import org.hibernate.sql.results.graph.entity.EntityResult; import org.hibernate.sql.results.graph.entity.EntityResult;
import org.hibernate.sql.results.graph.entity.EntityResultGraphNode; import org.hibernate.sql.results.graph.entity.EntityResultGraphNode;
@ -119,8 +117,8 @@ public class RootEntityResultImpl extends AbstractFetchParent implements EntityR
fetches = new ArrayList<>(); fetches = new ArrayList<>();
mappingType.visitAttributeMappings( mappingType.visitAttributeMappings(
attributeMapping -> { attributeMapping -> {
if ( attributeMapping instanceof SingularAssociationAttributeMapping ) { if ( attributeMapping instanceof ToOneAttributeMapping ) {
((SingularAssociationAttributeMapping)attributeMapping).getForeignKeyDescriptor().createDomainResult( ((ToOneAttributeMapping)attributeMapping).getForeignKeyDescriptor().createDomainResult(
navigablePath.append( EntityIdentifierMapping.ROLE_LOCAL_NAME ), navigablePath.append( EntityIdentifierMapping.ROLE_LOCAL_NAME ),
entityTableGroup, entityTableGroup,
null, null,

View File

@ -9,14 +9,12 @@ package org.hibernate.orm.test.bootstrap.binding.hbm.cid.nonaggregated.dynamic;
import org.hibernate.boot.MetadataSources; import org.hibernate.boot.MetadataSources;
import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.AvailableSettings;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.metamodel.mapping.AttributeMapping; import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.EntityIdentifierMapping; import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
import org.hibernate.metamodel.mapping.internal.BasicValuedSingularAttributeMapping; import org.hibernate.metamodel.mapping.internal.BasicValuedSingularAttributeMapping;
import org.hibernate.metamodel.mapping.internal.NonAggregatedIdentifierMappingImpl; import org.hibernate.metamodel.mapping.internal.NonAggregatedIdentifierMappingImpl;
import org.hibernate.metamodel.mapping.internal.SingularAssociationAttributeMapping; import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.tool.schema.Action;
import org.hibernate.testing.orm.junit.ServiceRegistry; import org.hibernate.testing.orm.junit.ServiceRegistry;
import org.hibernate.testing.orm.junit.ServiceRegistryScope; import org.hibernate.testing.orm.junit.ServiceRegistryScope;
@ -63,7 +61,7 @@ public class DynamicCompositeIdManyToOneTests {
final AttributeMapping key2 = cid.getEmbeddableTypeDescriptor().findAttributeMapping( "key2" ); final AttributeMapping key2 = cid.getEmbeddableTypeDescriptor().findAttributeMapping( "key2" );
assertThat( key2, notNullValue() ); assertThat( key2, notNullValue() );
assertThat( key2, instanceOf( SingularAssociationAttributeMapping.class ) ); assertThat( key2, instanceOf( ToOneAttributeMapping.class ) );
final AttributeMapping attr1 = entityDescriptor.findAttributeMapping( "attr1" ); final AttributeMapping attr1 = entityDescriptor.findAttributeMapping( "attr1" );
assertThat( attr1, notNullValue() ); assertThat( attr1, notNullValue() );

View File

@ -21,14 +21,11 @@ import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
import org.hibernate.metamodel.mapping.ModelPart; import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.internal.BasicValuedSingularAttributeMapping; import org.hibernate.metamodel.mapping.internal.BasicValuedSingularAttributeMapping;
import org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping; import org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping;
import org.hibernate.metamodel.mapping.internal.SingularAssociationAttributeMapping; import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.metamodel.model.convert.internal.NamedEnumValueConverter; import org.hibernate.metamodel.model.convert.internal.NamedEnumValueConverter;
import org.hibernate.metamodel.model.convert.internal.OrdinalEnumValueConverter; import org.hibernate.metamodel.model.convert.internal.OrdinalEnumValueConverter;
import org.hibernate.metamodel.model.convert.spi.BasicValueConverter; import org.hibernate.metamodel.model.convert.spi.BasicValueConverter;
import org.hibernate.metamodel.model.convert.spi.EnumValueConverter;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.type.CustomType;
import org.hibernate.usertype.UserType;
import org.hibernate.testing.hamcrest.CollectionMatchers; import org.hibernate.testing.hamcrest.CollectionMatchers;
import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.DomainModel;
@ -131,8 +128,8 @@ public class SmokeTests {
final ModelPart part = entityDescriptor.findSubPart( "simpleEntity" ); final ModelPart part = entityDescriptor.findSubPart( "simpleEntity" );
assertThat( part, notNullValue() ); assertThat( part, notNullValue() );
assertThat( part, instanceOf( SingularAssociationAttributeMapping.class ) ); assertThat( part, instanceOf( ToOneAttributeMapping.class ) );
final SingularAssociationAttributeMapping attrMapping = (SingularAssociationAttributeMapping) part; final ToOneAttributeMapping attrMapping = (ToOneAttributeMapping) part;
assertThat( attrMapping.getAttributeName(), is( "simpleEntity" ) ); assertThat( attrMapping.getAttributeName(), is( "simpleEntity" ) );
assertThat( attrMapping.getMappedTypeDescriptor(), is( simpleEntityDescriptor ) ); assertThat( attrMapping.getMappedTypeDescriptor(), is( simpleEntityDescriptor ) );
assertThat( assertThat(

View File

@ -16,7 +16,7 @@ import javax.persistence.Table;
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor; import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
import org.hibernate.metamodel.mapping.ModelPart; import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.internal.SingularAssociationAttributeMapping; import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.DomainModel;
@ -51,9 +51,9 @@ public class ManyToOneJoinTableTest {
final ModelPart simpleEntityAssociation = otherDescriptor.findSubPart( "simpleEntity" ); final ModelPart simpleEntityAssociation = otherDescriptor.findSubPart( "simpleEntity" );
assertThat( simpleEntityAssociation, instanceOf( SingularAssociationAttributeMapping.class ) ); assertThat( simpleEntityAssociation, instanceOf( ToOneAttributeMapping.class ) );
final SingularAssociationAttributeMapping simpleAttributeMapping = (SingularAssociationAttributeMapping) simpleEntityAssociation; final ToOneAttributeMapping simpleAttributeMapping = (ToOneAttributeMapping) simpleEntityAssociation;
ForeignKeyDescriptor foreignKeyDescriptor = simpleAttributeMapping.getForeignKeyDescriptor(); ForeignKeyDescriptor foreignKeyDescriptor = simpleAttributeMapping.getForeignKeyDescriptor();
foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> { foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> {
@ -68,9 +68,9 @@ public class ManyToOneJoinTableTest {
final ModelPart anotherEntityAssociation = otherDescriptor.findSubPart( "anotherEntity" ); final ModelPart anotherEntityAssociation = otherDescriptor.findSubPart( "anotherEntity" );
assertThat( anotherEntityAssociation, instanceOf( SingularAssociationAttributeMapping.class ) ); assertThat( anotherEntityAssociation, instanceOf( ToOneAttributeMapping.class ) );
final SingularAssociationAttributeMapping anotherAttributeMapping = (SingularAssociationAttributeMapping) anotherEntityAssociation; final ToOneAttributeMapping anotherAttributeMapping = (ToOneAttributeMapping) anotherEntityAssociation;
foreignKeyDescriptor = anotherAttributeMapping.getForeignKeyDescriptor(); foreignKeyDescriptor = anotherAttributeMapping.getForeignKeyDescriptor();
foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> { foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> {
@ -90,9 +90,9 @@ public class ManyToOneJoinTableTest {
ModelPart otherEntityEntityAssociation = simpleDescriptor.findSubPart( "other" ); ModelPart otherEntityEntityAssociation = simpleDescriptor.findSubPart( "other" );
assertThat( otherEntityEntityAssociation, instanceOf( SingularAssociationAttributeMapping.class ) ); assertThat( otherEntityEntityAssociation, instanceOf( ToOneAttributeMapping.class ) );
SingularAssociationAttributeMapping otherAttributeMapping = (SingularAssociationAttributeMapping) otherEntityEntityAssociation; ToOneAttributeMapping otherAttributeMapping = (ToOneAttributeMapping) otherEntityEntityAssociation;
foreignKeyDescriptor = otherAttributeMapping.getForeignKeyDescriptor(); foreignKeyDescriptor = otherAttributeMapping.getForeignKeyDescriptor();
foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> { foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> {
@ -112,9 +112,9 @@ public class ManyToOneJoinTableTest {
otherEntityEntityAssociation = anotherDescriptor.findSubPart( "other" ); otherEntityEntityAssociation = anotherDescriptor.findSubPart( "other" );
assertThat( otherEntityEntityAssociation, instanceOf( SingularAssociationAttributeMapping.class ) ); assertThat( otherEntityEntityAssociation, instanceOf( ToOneAttributeMapping.class ) );
otherAttributeMapping = (SingularAssociationAttributeMapping) otherEntityEntityAssociation; otherAttributeMapping = (ToOneAttributeMapping) otherEntityEntityAssociation;
foreignKeyDescriptor = otherAttributeMapping.getForeignKeyDescriptor(); foreignKeyDescriptor = otherAttributeMapping.getForeignKeyDescriptor();
foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> { foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> {

View File

@ -14,7 +14,7 @@ import javax.persistence.Table;
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor; import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
import org.hibernate.metamodel.mapping.ModelPart; import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.internal.SingularAssociationAttributeMapping; import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.DomainModel;
@ -48,9 +48,9 @@ public class ManyToOneTest {
final ModelPart simpleEntityAssociation = otherDescriptor.findSubPart( "simpleEntity" ); final ModelPart simpleEntityAssociation = otherDescriptor.findSubPart( "simpleEntity" );
assertThat( simpleEntityAssociation, instanceOf( SingularAssociationAttributeMapping.class ) ); assertThat( simpleEntityAssociation, instanceOf( ToOneAttributeMapping.class ) );
final SingularAssociationAttributeMapping childAttributeMapping = (SingularAssociationAttributeMapping) simpleEntityAssociation; final ToOneAttributeMapping childAttributeMapping = (ToOneAttributeMapping) simpleEntityAssociation;
ForeignKeyDescriptor foreignKeyDescriptor = childAttributeMapping.getForeignKeyDescriptor(); ForeignKeyDescriptor foreignKeyDescriptor = childAttributeMapping.getForeignKeyDescriptor();
foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> { foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> {

View File

@ -13,7 +13,7 @@ import javax.persistence.Table;
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor; import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
import org.hibernate.metamodel.mapping.ModelPart; import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.internal.SingularAssociationAttributeMapping; import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.DomainModel;
@ -46,9 +46,9 @@ public class EntityWithBidirectionalAssociationTest {
final ModelPart childAssociation = parentDescriptor.findSubPart( "child" ); final ModelPart childAssociation = parentDescriptor.findSubPart( "child" );
assertThat( childAssociation, instanceOf( SingularAssociationAttributeMapping.class ) ); assertThat( childAssociation, instanceOf( ToOneAttributeMapping.class ) );
final SingularAssociationAttributeMapping childAttributeMapping = (SingularAssociationAttributeMapping) childAssociation; final ToOneAttributeMapping childAttributeMapping = (ToOneAttributeMapping) childAssociation;
ForeignKeyDescriptor foreignKeyDescriptor = childAttributeMapping.getForeignKeyDescriptor(); ForeignKeyDescriptor foreignKeyDescriptor = childAttributeMapping.getForeignKeyDescriptor();
foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> { foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> {
@ -67,9 +67,9 @@ public class EntityWithBidirectionalAssociationTest {
final ModelPart parentAssociation = childDescriptor.findSubPart( "parent" ); final ModelPart parentAssociation = childDescriptor.findSubPart( "parent" );
assertThat( parentAssociation, instanceOf( SingularAssociationAttributeMapping.class ) ); assertThat( parentAssociation, instanceOf( ToOneAttributeMapping.class ) );
final SingularAssociationAttributeMapping parentAttributeMapping = (SingularAssociationAttributeMapping) parentAssociation; final ToOneAttributeMapping parentAttributeMapping = (ToOneAttributeMapping) parentAssociation;
foreignKeyDescriptor = parentAttributeMapping.getForeignKeyDescriptor(); foreignKeyDescriptor = parentAttributeMapping.getForeignKeyDescriptor();
foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> { foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> {

View File

@ -15,7 +15,7 @@ import javax.persistence.Table;
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor; import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
import org.hibernate.metamodel.mapping.ModelPart; import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.internal.SingularAssociationAttributeMapping; import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.DomainModel;
@ -48,9 +48,9 @@ public class EntityWithOneBidirectionalJoinTableAssociationTest {
final ModelPart childAssociation = parentDescriptor.findSubPart( "child" ); final ModelPart childAssociation = parentDescriptor.findSubPart( "child" );
assertThat( childAssociation, instanceOf( SingularAssociationAttributeMapping.class ) ); assertThat( childAssociation, instanceOf( ToOneAttributeMapping.class ) );
final SingularAssociationAttributeMapping childAttributeMapping = (SingularAssociationAttributeMapping) childAssociation; final ToOneAttributeMapping childAttributeMapping = (ToOneAttributeMapping) childAssociation;
ForeignKeyDescriptor foreignKeyDescriptor = childAttributeMapping.getForeignKeyDescriptor(); ForeignKeyDescriptor foreignKeyDescriptor = childAttributeMapping.getForeignKeyDescriptor();
foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> { foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> {
@ -69,9 +69,9 @@ public class EntityWithOneBidirectionalJoinTableAssociationTest {
final ModelPart parentAssociation = childDescriptor.findSubPart( "parent" ); final ModelPart parentAssociation = childDescriptor.findSubPart( "parent" );
assertThat( parentAssociation, instanceOf( SingularAssociationAttributeMapping.class ) ); assertThat( parentAssociation, instanceOf( ToOneAttributeMapping.class ) );
final SingularAssociationAttributeMapping parentAttributeMapping = (SingularAssociationAttributeMapping) parentAssociation; final ToOneAttributeMapping parentAttributeMapping = (ToOneAttributeMapping) parentAssociation;
foreignKeyDescriptor = parentAttributeMapping.getForeignKeyDescriptor(); foreignKeyDescriptor = parentAttributeMapping.getForeignKeyDescriptor();
foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> { foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> {

View File

@ -8,7 +8,7 @@ package org.hibernate.orm.test.metamodel.mapping.onetoone;
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor; import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
import org.hibernate.metamodel.mapping.ModelPart; import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.internal.SingularAssociationAttributeMapping; import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.testing.orm.domain.gambit.EntityWithOneToOneJoinTable; import org.hibernate.testing.orm.domain.gambit.EntityWithOneToOneJoinTable;
@ -42,9 +42,9 @@ public class EntityWithOneToOneJoinTableTest {
.getMetamodel() .getMetamodel()
.findEntityDescriptor( EntityWithOneToOneJoinTable.class ); .findEntityDescriptor( EntityWithOneToOneJoinTable.class );
final ModelPart other = entityWithOneToOneJoinTableDescriptor.findSubPart( "other" ); final ModelPart other = entityWithOneToOneJoinTableDescriptor.findSubPart( "other" );
assertThat( other, instanceOf( SingularAssociationAttributeMapping.class ) ); assertThat( other, instanceOf( ToOneAttributeMapping.class ) );
final SingularAssociationAttributeMapping otherAttributeMapping = (SingularAssociationAttributeMapping) other; final ToOneAttributeMapping otherAttributeMapping = (ToOneAttributeMapping) other;
final ForeignKeyDescriptor foreignKeyDescriptor = otherAttributeMapping.getForeignKeyDescriptor(); final ForeignKeyDescriptor foreignKeyDescriptor = otherAttributeMapping.getForeignKeyDescriptor();
foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> { foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> {

View File

@ -8,7 +8,7 @@ package org.hibernate.orm.test.metamodel.mapping.onetoone;
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor; import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
import org.hibernate.metamodel.mapping.ModelPart; import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.internal.SingularAssociationAttributeMapping; import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.testing.orm.domain.gambit.EntityWithOneToOneSharingPrimaryKey; import org.hibernate.testing.orm.domain.gambit.EntityWithOneToOneSharingPrimaryKey;
@ -43,9 +43,9 @@ public class EntityWithOneToOneSharingPrimaryKeyTest {
final ModelPart otherAssociation = entityDescriptor.findSubPart( "other" ); final ModelPart otherAssociation = entityDescriptor.findSubPart( "other" );
assertThat( otherAssociation, instanceOf( SingularAssociationAttributeMapping.class ) ); assertThat( otherAssociation, instanceOf( ToOneAttributeMapping.class ) );
final SingularAssociationAttributeMapping otherAttributeMapping = (SingularAssociationAttributeMapping) otherAssociation; final ToOneAttributeMapping otherAttributeMapping = (ToOneAttributeMapping) otherAssociation;
ForeignKeyDescriptor foreignKeyDescriptor = otherAttributeMapping.getForeignKeyDescriptor(); ForeignKeyDescriptor foreignKeyDescriptor = otherAttributeMapping.getForeignKeyDescriptor();
foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> { foreignKeyDescriptor.visitReferringColumns( (keyTable, keyColumn, jdbcMapping) -> {