HHH-15851 Mixup of entities in refresh with BatchSize
This commit is contained in:
parent
72985d7c4d
commit
8b86e082ef
|
@ -414,7 +414,7 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
|
|||
final Object entityInstanceFromExecutionContext =
|
||||
rowProcessingState.getJdbcValuesSourceProcessingState().getExecutionContext().getEntityInstance();
|
||||
if ( isProxyInstance( proxy ) ) {
|
||||
if ( this instanceof EntityResultInitializer && entityInstanceFromExecutionContext != null ) {
|
||||
if ( useEntityInstanceFromExecutionContext( entityInstanceFromExecutionContext, persistenceContext.getSession() ) ) {
|
||||
entityInstance = entityInstanceFromExecutionContext;
|
||||
registerLoadingEntity( rowProcessingState, entityInstance );
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
|
|||
this.isInitialized = true;
|
||||
}
|
||||
}
|
||||
else if ( this instanceof EntityResultInitializer && entityInstanceFromExecutionContext != null ) {
|
||||
else if ( useEntityInstanceFromExecutionContext( entityInstanceFromExecutionContext, persistenceContext.getSession() ) ) {
|
||||
entityInstance = entityInstanceFromExecutionContext;
|
||||
registerLoadingEntity( rowProcessingState, entityInstance );
|
||||
}
|
||||
|
@ -445,6 +445,19 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
|
|||
}
|
||||
}
|
||||
|
||||
private boolean useEntityInstanceFromExecutionContext(
|
||||
Object entityInstanceFromExecutionContext,
|
||||
SharedSessionContractImplementor session) {
|
||||
if ( this instanceof EntityResultInitializer
|
||||
&& entityInstanceFromExecutionContext != null
|
||||
&& entityKey.getIdentifier()
|
||||
.equals( entityDescriptor.getIdentifier( entityInstanceFromExecutionContext, session ) )
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void upgradeLockMode(RowProcessingState rowProcessingState) {
|
||||
if ( lockMode != LockMode.NONE ) {
|
||||
final EntityEntry entry =
|
||||
|
|
Loading…
Reference in New Issue