HHH-16155 Disable batching when generated properties are found

This commit is contained in:
Marco Belladelli 2023-02-16 11:05:22 +01:00 committed by Christian Beikov
parent c3174e6b62
commit 4cc5941798
2 changed files with 20 additions and 8 deletions

View File

@ -54,10 +54,16 @@ public class InsertCoordinator extends AbstractMutationCoordinator {
public InsertCoordinator(AbstractEntityPersister entityPersister, SessionFactoryImplementor factory) {
super( entityPersister, factory );
insertBatchKey = new BasicBatchKey(
entityPersister.getEntityName() + "#INSERT",
null
);
if ( entityPersister.hasInsertGeneratedProperties() ) {
// disable batching in case of insert generated properties
insertBatchKey = null;
}
else {
insertBatchKey = new BasicBatchKey(
entityPersister.getEntityName() + "#INSERT",
null
);
}
if ( entityPersister.getEntityMetamodel().isDynamicInsert() ) {
// the entity specified dynamic-insert - skip generating the

View File

@ -89,10 +89,16 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
// there are cases where we need the full static updates.
this.staticUpdateGroup = buildStaticUpdateGroup();
this.versionUpdateGroup = buildVersionUpdateGroup();
this.batchKey = new BasicBatchKey(
entityPersister.getEntityName() + "#UPDATE",
null
);
if ( entityPersister.hasUpdateGeneratedProperties() ) {
// disable batching in case of update generated properties
this.batchKey = null;
}
else {
this.batchKey = new BasicBatchKey(
entityPersister.getEntityName() + "#UPDATE",
null
);
}
}
@Override