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 );
if ( entityPersister.hasInsertGeneratedProperties() ) {
// disable batching in case of insert generated properties
insertBatchKey = null;
}
else {
insertBatchKey = new BasicBatchKey( insertBatchKey = new BasicBatchKey(
entityPersister.getEntityName() + "#INSERT", entityPersister.getEntityName() + "#INSERT",
null 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,11 +89,17 @@ 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();
if ( entityPersister.hasUpdateGeneratedProperties() ) {
// disable batching in case of update generated properties
this.batchKey = null;
}
else {
this.batchKey = new BasicBatchKey( this.batchKey = new BasicBatchKey(
entityPersister.getEntityName() + "#UPDATE", entityPersister.getEntityName() + "#UPDATE",
null null
); );
} }
}
@Override @Override
public MutationOperationGroup getStaticUpdateGroup() { public MutationOperationGroup getStaticUpdateGroup() {