HHH-15449 @ManyToOne associations not loaded correctly with default EAGER and batch fetch property set when using TypedQuery.resultStream
This commit is contained in:
parent
960b2c7f1c
commit
021429b519
|
@ -228,6 +228,12 @@ public class JdbcSelectExecutorStandardImpl implements JdbcSelectExecutor {
|
|||
final Limit limit = queryOptions.getLimit();
|
||||
|
||||
return new ExecutionContext() {
|
||||
|
||||
@Override
|
||||
public boolean isScrollResult() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryOptions getQueryOptions() {
|
||||
|
||||
|
|
|
@ -21,6 +21,10 @@ import org.hibernate.sql.results.graph.entity.LoadingEntityEntry;
|
|||
*/
|
||||
public interface ExecutionContext {
|
||||
|
||||
default boolean isScrollResult(){
|
||||
return false;
|
||||
}
|
||||
|
||||
SharedSessionContractImplementor getSession();
|
||||
|
||||
QueryOptions getQueryOptions();
|
||||
|
|
|
@ -18,6 +18,10 @@ import org.hibernate.sql.ast.spi.SqlAstCreationContext;
|
|||
*/
|
||||
public interface AssemblerCreationState {
|
||||
|
||||
default boolean isScrollResult() {
|
||||
return false;
|
||||
}
|
||||
|
||||
LockMode determineEffectiveLockMode(String identificationVariable);
|
||||
|
||||
Initializer resolveInitializer(
|
||||
|
|
|
@ -69,7 +69,7 @@ public class EntityFetchSelectImpl extends AbstractNonJoinedEntityFetch {
|
|||
keyResult.createResultAssembler( parentAccess, creationState )
|
||||
);
|
||||
}
|
||||
if ( entityPersister.isBatchLoadable() ) {
|
||||
if ( entityPersister.isBatchLoadable() && !creationState.isScrollResult() ) {
|
||||
return new BatchEntitySelectFetchInitializer(
|
||||
parentAccess,
|
||||
fetchedAttribute,
|
||||
|
|
|
@ -66,6 +66,12 @@ public class ResultsHelper {
|
|||
|
||||
final List<DomainResultAssembler<?>> assemblers = jdbcValues.getValuesMapping().resolveAssemblers(
|
||||
new AssemblerCreationState() {
|
||||
|
||||
@Override
|
||||
public boolean isScrollResult() {
|
||||
return executionContext.isScrollResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LockMode determineEffectiveLockMode(String identificationVariable) {
|
||||
return lockOptions.getEffectiveLockMode( identificationVariable );
|
||||
|
|
Loading…
Reference in New Issue