HHH-16106 Using BatchEntitySelectFetchInitializer causes PostLoad to be called before references are initialized
This commit is contained in:
parent
10458da711
commit
6c385f7890
|
@ -163,13 +163,6 @@ public class JdbcValuesSourceProcessingStateStandardImpl implements JdbcValuesSo
|
|||
|
||||
@Override
|
||||
public void finishUp() {
|
||||
// for arrays, we should end the collection load beforeQuery resolving the entities, since the
|
||||
// actual array instances are not instantiated during loading
|
||||
finishLoadingArrays();
|
||||
|
||||
// now finish loading the entities (2-phase load)
|
||||
performTwoPhaseLoad();
|
||||
|
||||
// now we can finalize loading collections
|
||||
finishLoadingCollections();
|
||||
|
||||
|
@ -207,22 +200,6 @@ public class JdbcValuesSourceProcessingStateStandardImpl implements JdbcValuesSo
|
|||
loadingEntityMap = null;
|
||||
}
|
||||
|
||||
private void finishLoadingArrays() {
|
||||
if ( arrayInitializers != null ) {
|
||||
for ( CollectionInitializer collectionInitializer : arrayInitializers ) {
|
||||
collectionInitializer.endLoading( executionContext );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void performTwoPhaseLoad() {
|
||||
if ( loadingEntityMap == null ) {
|
||||
return;
|
||||
}
|
||||
log.tracev( "Total objects hydrated: {0}", loadingEntityMap.size() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("SimplifiableIfStatement")
|
||||
private boolean isReadOnly() {
|
||||
if ( getQueryOptions().isReadOnly() != null ) {
|
||||
|
|
|
@ -201,6 +201,7 @@ public class ListResultsConsumer<R> implements ResultsConsumer<List<R>, R> {
|
|||
}
|
||||
|
||||
try {
|
||||
rowReader.finishUp( jdbcValuesSourceProcessingState );
|
||||
jdbcValuesSourceProcessingState.finishUp();
|
||||
}
|
||||
finally {
|
||||
|
@ -220,7 +221,7 @@ public class ListResultsConsumer<R> implements ResultsConsumer<List<R>, R> {
|
|||
}
|
||||
finally {
|
||||
try {
|
||||
rowReader.finishUp( jdbcValuesSourceProcessingState );
|
||||
|
||||
jdbcValues.finishUp( session );
|
||||
persistenceContext.initializeNonLazyCollections();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue