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
|
@Override
|
||||||
public void finishUp() {
|
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
|
// now we can finalize loading collections
|
||||||
finishLoadingCollections();
|
finishLoadingCollections();
|
||||||
|
|
||||||
|
@ -207,22 +200,6 @@ public class JdbcValuesSourceProcessingStateStandardImpl implements JdbcValuesSo
|
||||||
loadingEntityMap = null;
|
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")
|
@SuppressWarnings("SimplifiableIfStatement")
|
||||||
private boolean isReadOnly() {
|
private boolean isReadOnly() {
|
||||||
if ( getQueryOptions().isReadOnly() != null ) {
|
if ( getQueryOptions().isReadOnly() != null ) {
|
||||||
|
|
|
@ -201,6 +201,7 @@ public class ListResultsConsumer<R> implements ResultsConsumer<List<R>, R> {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
rowReader.finishUp( jdbcValuesSourceProcessingState );
|
||||||
jdbcValuesSourceProcessingState.finishUp();
|
jdbcValuesSourceProcessingState.finishUp();
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
@ -220,7 +221,7 @@ public class ListResultsConsumer<R> implements ResultsConsumer<List<R>, R> {
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
try {
|
try {
|
||||||
rowReader.finishUp( jdbcValuesSourceProcessingState );
|
|
||||||
jdbcValues.finishUp( session );
|
jdbcValues.finishUp( session );
|
||||||
persistenceContext.initializeNonLazyCollections();
|
persistenceContext.initializeNonLazyCollections();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue