diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/EntityCollectionPart.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/EntityCollectionPart.java index 333a63794e..475bf4288f 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/EntityCollectionPart.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/EntityCollectionPart.java @@ -63,7 +63,6 @@ public class EntityCollectionPart MappingModelCreationProcess creationProcess) { this.navigableRole = collectionDescriptor.getNavigableRole().appendContainer( nature.getName() ); this.collectionDescriptor = collectionDescriptor; - this.nature = nature; this.entityMappingType = entityMappingType; } @@ -163,6 +162,16 @@ public class EntityCollectionPart return new EntityFetchJoinedImpl( fetchParent, this, tableGroup, selected, fetchablePath, creationState ); } + @Override + public boolean isOptional() { + return false; + } + + @Override + public boolean isUnwrapProxy() { + return false; + } + @Override public DomainResult createDomainResult( NavigablePath navigablePath, diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java index 140c96ab3f..416cec6f1a 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java @@ -1050,6 +1050,7 @@ public class ToOneAttributeMapping return isNullable; } + @Override public boolean isOptional(){ return isOptional; } @@ -1062,6 +1063,7 @@ public class ToOneAttributeMapping return isIgnoreNotFound; } + @Override public boolean isUnwrapProxy() { return unwrapProxy; } diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/EntityValuedFetchable.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/EntityValuedFetchable.java index 630f4bd9f6..238dfb788f 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/EntityValuedFetchable.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/EntityValuedFetchable.java @@ -25,4 +25,8 @@ public interface EntityValuedFetchable extends Fetchable, EntityValuedModelPart boolean selected, String resultVariable, DomainResultCreationState creationState); + + boolean isOptional(); + + boolean isUnwrapProxy(); } diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityDelayedFetchInitializer.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityDelayedFetchInitializer.java index 32b9a7b7b9..786ce7f8f9 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityDelayedFetchInitializer.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityDelayedFetchInitializer.java @@ -8,11 +8,15 @@ package org.hibernate.sql.results.graph.entity.internal; import java.util.function.Consumer; +import org.hibernate.LockMode; import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer; import org.hibernate.engine.spi.EntityKey; import org.hibernate.engine.spi.PersistenceContext; +import org.hibernate.engine.spi.SharedSessionContractImplementor; +import org.hibernate.event.spi.EventSource; import org.hibernate.internal.log.LoggingHelper; +import org.hibernate.loader.entity.CacheEntityLoaderHelper; import org.hibernate.metamodel.mapping.ModelPart; import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping; import org.hibernate.persister.entity.EntityPersister; @@ -21,8 +25,10 @@ import org.hibernate.query.NavigablePath; import org.hibernate.sql.results.graph.AbstractFetchParentAccess; import org.hibernate.sql.results.graph.DomainResultAssembler; import org.hibernate.sql.results.graph.entity.EntityInitializer; +import org.hibernate.sql.results.graph.entity.EntityValuedFetchable; import org.hibernate.sql.results.graph.entity.LoadingEntityEntry; import org.hibernate.sql.results.jdbc.spi.RowProcessingState; +import org.hibernate.stat.spi.StatisticsImplementor; /** * @author Andrea Boriero @@ -31,7 +37,7 @@ import org.hibernate.sql.results.jdbc.spi.RowProcessingState; public class EntityDelayedFetchInitializer extends AbstractFetchParentAccess implements EntityInitializer { private final NavigablePath navigablePath; - private final ToOneAttributeMapping referencedModelPart; + private final EntityValuedFetchable referencedModelPart; private final DomainResultAssembler identifierAssembler; private Object entityInstance; @@ -39,7 +45,7 @@ public class EntityDelayedFetchInitializer extends AbstractFetchParentAccess imp public EntityDelayedFetchInitializer( NavigablePath fetchedNavigable, - ToOneAttributeMapping referencedModelPart, + EntityValuedFetchable referencedModelPart, DomainResultAssembler identifierAssembler) { this.navigablePath = fetchedNavigable; this.referencedModelPart = referencedModelPart;