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) { public InsertCoordinator(AbstractEntityPersister entityPersister, SessionFactoryImplementor factory) {
super( entityPersister, factory ); super( entityPersister, factory );
insertBatchKey = new BasicBatchKey( if ( entityPersister.hasInsertGeneratedProperties() ) {
entityPersister.getEntityName() + "#INSERT", // disable batching in case of insert generated properties
null insertBatchKey = null;
); }
else {
insertBatchKey = new BasicBatchKey(
entityPersister.getEntityName() + "#INSERT",
null
);
}
if ( entityPersister.getEntityMetamodel().isDynamicInsert() ) { if ( entityPersister.getEntityMetamodel().isDynamicInsert() ) {
// the entity specified dynamic-insert - skip generating the // 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. // there are cases where we need the full static updates.
this.staticUpdateGroup = buildStaticUpdateGroup(); this.staticUpdateGroup = buildStaticUpdateGroup();
this.versionUpdateGroup = buildVersionUpdateGroup(); this.versionUpdateGroup = buildVersionUpdateGroup();
this.batchKey = new BasicBatchKey( if ( entityPersister.hasUpdateGeneratedProperties() ) {
entityPersister.getEntityName() + "#UPDATE", // disable batching in case of update generated properties
null this.batchKey = null;
); }
else {
this.batchKey = new BasicBatchKey(
entityPersister.getEntityName() + "#UPDATE",
null
);
}
} }
@Override @Override