HHH-16877 Efficient lookup of MutationExecutorService
This commit is contained in:
parent
afd3bee28e
commit
abc4f9f356
|
@ -403,6 +403,7 @@ public final class FastSessionServices {
|
|||
return xmlFormatMapper;
|
||||
}
|
||||
|
||||
@Deprecated //This seems no longer used - cleanup?
|
||||
public MutationExecutorService getMutationExecutorService() {
|
||||
return mutationExecutorService;
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ public class BasicCollectionPersister extends AbstractCollectionPersister {
|
|||
return new InsertRowsCoordinatorNoOp( this );
|
||||
}
|
||||
|
||||
return new InsertRowsCoordinatorStandard( this, rowMutationOperations );
|
||||
return new InsertRowsCoordinatorStandard( this, rowMutationOperations, getFactory().getServiceRegistry() );
|
||||
}
|
||||
|
||||
private DeleteRowsCoordinator buildDeleteRowCoordinator() {
|
||||
|
@ -192,7 +192,7 @@ public class BasicCollectionPersister extends AbstractCollectionPersister {
|
|||
return new DeleteRowsCoordinatorNoOp( this );
|
||||
}
|
||||
|
||||
return new DeleteRowsCoordinatorStandard( this, rowMutationOperations, hasPhysicalIndexColumn() );
|
||||
return new DeleteRowsCoordinatorStandard( this, rowMutationOperations, hasPhysicalIndexColumn(), getFactory().getServiceRegistry() );
|
||||
}
|
||||
|
||||
private RemoveCoordinator buildDeleteAllCoordinator() {
|
||||
|
@ -206,7 +206,7 @@ public class BasicCollectionPersister extends AbstractCollectionPersister {
|
|||
return new RemoveCoordinatorNoOp( this );
|
||||
}
|
||||
|
||||
return new RemoveCoordinatorStandard( this, this::buildDeleteAllOperation );
|
||||
return new RemoveCoordinatorStandard( this, this::buildDeleteAllOperation, getFactory().getServiceRegistry() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -106,6 +106,7 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
|||
private final boolean cascadeDeleteEnabled;
|
||||
private final boolean keyIsNullable;
|
||||
private final boolean keyIsUpdateable;
|
||||
private final MutationExecutorService mutationExecutorService;
|
||||
|
||||
@Deprecated(since = "6.0")
|
||||
public OneToManyPersister(
|
||||
|
@ -131,6 +132,7 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
|||
this.updateRowsCoordinator = buildUpdateCoordinator();
|
||||
this.deleteRowsCoordinator = buildDeleteCoordinator();
|
||||
this.removeCoordinator = buildDeleteAllCoordinator();
|
||||
this.mutationExecutorService = creationContext.getServiceRegistry().getService( MutationExecutorService.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -225,9 +227,6 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
|||
final RowMutationOperations.Restrictions updateRowRestrictions = rowMutationOperations.getUpdateRowRestrictions();
|
||||
assert NullnessHelper.areAllNonNull( updateRowOperation, updateRowValues, updateRowRestrictions );
|
||||
|
||||
final MutationExecutorService mutationExecutorService = getFactory()
|
||||
.getFastSessionServices()
|
||||
.getMutationExecutorService();
|
||||
final MutationExecutor mutationExecutor = mutationExecutorService.createExecutor(
|
||||
() -> new BasicBatchKey( getNavigableRole() + "#INDEX" ),
|
||||
new MutationOperationGroupSingle( MutationType.UPDATE, this, updateRowOperation ),
|
||||
|
@ -453,9 +452,9 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
|||
|
||||
if ( getElementPersisterInternal() != null && getElementPersisterInternal().hasSubclasses()
|
||||
&& getElementPersisterInternal() instanceof UnionSubclassEntityPersister ) {
|
||||
return new InsertRowsCoordinatorTablePerSubclass( this, rowMutationOperations );
|
||||
return new InsertRowsCoordinatorTablePerSubclass( this, rowMutationOperations, getFactory().getServiceRegistry() );
|
||||
}
|
||||
return new InsertRowsCoordinatorStandard( this, rowMutationOperations );
|
||||
return new InsertRowsCoordinatorStandard( this, rowMutationOperations, getFactory().getServiceRegistry() );
|
||||
}
|
||||
|
||||
private UpdateRowsCoordinator buildUpdateCoordinator() {
|
||||
|
@ -490,13 +489,14 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
|||
|
||||
if ( getElementPersisterInternal() != null && getElementPersisterInternal().hasSubclasses()
|
||||
&& getElementPersisterInternal() instanceof UnionSubclassEntityPersister ) {
|
||||
return new DeleteRowsCoordinatorTablePerSubclass( this, rowMutationOperations, false );
|
||||
return new DeleteRowsCoordinatorTablePerSubclass( this, rowMutationOperations, false, getFactory().getServiceRegistry() );
|
||||
}
|
||||
return new DeleteRowsCoordinatorStandard(
|
||||
this,
|
||||
rowMutationOperations,
|
||||
// never delete by index for one-to-many
|
||||
false
|
||||
false,
|
||||
getFactory().getServiceRegistry()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -513,9 +513,9 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
|||
|
||||
if ( getElementPersisterInternal() != null && getElementPersisterInternal().hasSubclasses()
|
||||
&& getElementPersisterInternal() instanceof UnionSubclassEntityPersister ) {
|
||||
return new RemoveCoordinatorTablePerSubclass( this, this::buildDeleteAllOperation );
|
||||
return new RemoveCoordinatorTablePerSubclass( this, this::buildDeleteAllOperation, getFactory().getServiceRegistry() );
|
||||
}
|
||||
return new RemoveCoordinatorStandard( this, this::buildDeleteAllOperation );
|
||||
return new RemoveCoordinatorStandard( this, this::buildDeleteAllOperation, getFactory().getServiceRegistry() );
|
||||
}
|
||||
|
||||
private JdbcMutationOperation generateDeleteRowOperation(MutatingTableReference tableReference) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
package org.hibernate.persister.collection.mutation;
|
||||
|
||||
import org.hibernate.collection.spi.PersistentCollection;
|
||||
import org.hibernate.engine.jdbc.mutation.spi.MutationExecutorService;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
|
||||
|
@ -18,10 +19,12 @@ import static org.hibernate.sql.model.ModelMutationLogging.MODEL_MUTATION_LOGGER
|
|||
public abstract class AbstractUpdateRowsCoordinator implements UpdateRowsCoordinator {
|
||||
private final CollectionMutationTarget mutationTarget;
|
||||
private final SessionFactoryImplementor sessionFactory;
|
||||
protected final MutationExecutorService mutationExecutorService;
|
||||
|
||||
public AbstractUpdateRowsCoordinator(CollectionMutationTarget mutationTarget, SessionFactoryImplementor sessionFactory) {
|
||||
this.mutationTarget = mutationTarget;
|
||||
this.sessionFactory = sessionFactory;
|
||||
this.mutationExecutorService = sessionFactory.getServiceRegistry().getService( MutationExecutorService.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,11 +12,11 @@ import org.hibernate.collection.spi.PersistentCollection;
|
|||
import org.hibernate.engine.jdbc.batch.internal.BasicBatchKey;
|
||||
import org.hibernate.engine.jdbc.mutation.JdbcValueBindings;
|
||||
import org.hibernate.engine.jdbc.mutation.MutationExecutor;
|
||||
import org.hibernate.engine.jdbc.mutation.ParameterUsage;
|
||||
import org.hibernate.engine.jdbc.mutation.spi.MutationExecutorService;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.sql.model.MutationType;
|
||||
import org.hibernate.sql.model.internal.MutationOperationGroupSingle;
|
||||
import org.hibernate.sql.model.jdbc.JdbcMutationOperation;
|
||||
|
@ -33,18 +33,21 @@ public class DeleteRowsCoordinatorStandard implements DeleteRowsCoordinator {
|
|||
private final boolean deleteByIndex;
|
||||
|
||||
private final BasicBatchKey batchKey;
|
||||
private final MutationExecutorService mutationExecutorService;
|
||||
|
||||
private MutationOperationGroupSingle operationGroup;
|
||||
|
||||
public DeleteRowsCoordinatorStandard(
|
||||
CollectionMutationTarget mutationTarget,
|
||||
RowMutationOperations rowMutationOperations,
|
||||
boolean deleteByIndex) {
|
||||
boolean deleteByIndex,
|
||||
ServiceRegistry serviceRegistry) {
|
||||
this.mutationTarget = mutationTarget;
|
||||
this.rowMutationOperations = rowMutationOperations;
|
||||
this.deleteByIndex = deleteByIndex;
|
||||
|
||||
this.batchKey = new BasicBatchKey( mutationTarget.getRolePath() + "#DELETE" );
|
||||
this.mutationExecutorService = serviceRegistry.getService( MutationExecutorService.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,10 +69,6 @@ public class DeleteRowsCoordinatorStandard implements DeleteRowsCoordinator {
|
|||
);
|
||||
}
|
||||
|
||||
final MutationExecutorService mutationExecutorService = session
|
||||
.getFactory()
|
||||
.getFastSessionServices()
|
||||
.getMutationExecutorService();
|
||||
final MutationExecutor mutationExecutor = mutationExecutorService.createExecutor(
|
||||
() -> batchKey,
|
||||
operationGroup,
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
|||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.collection.OneToManyPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.sql.model.MutationType;
|
||||
import org.hibernate.sql.model.internal.MutationOperationGroupSingle;
|
||||
import org.hibernate.sql.model.jdbc.JdbcMutationOperation;
|
||||
|
@ -37,15 +38,18 @@ public class DeleteRowsCoordinatorTablePerSubclass implements DeleteRowsCoordina
|
|||
private final boolean deleteByIndex;
|
||||
|
||||
private final SubclassEntry[] subclassEntries;
|
||||
private final MutationExecutorService mutationExecutorService;
|
||||
|
||||
public DeleteRowsCoordinatorTablePerSubclass(
|
||||
OneToManyPersister mutationTarget,
|
||||
RowMutationOperations rowMutationOperations,
|
||||
boolean deleteByIndex) {
|
||||
boolean deleteByIndex,
|
||||
ServiceRegistry serviceRegistry) {
|
||||
this.mutationTarget = mutationTarget;
|
||||
this.rowMutationOperations = rowMutationOperations;
|
||||
this.deleteByIndex = deleteByIndex;
|
||||
this.subclassEntries = new SubclassEntry[mutationTarget.getElementPersister().getRootEntityDescriptor().getSubclassEntityNames().size()];
|
||||
this.mutationExecutorService = serviceRegistry.getService( MutationExecutorService.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,11 +67,6 @@ public class DeleteRowsCoordinatorTablePerSubclass implements DeleteRowsCoordina
|
|||
);
|
||||
}
|
||||
|
||||
final MutationExecutorService mutationExecutorService = session
|
||||
.getFactory()
|
||||
.getFastSessionServices()
|
||||
.getMutationExecutorService();
|
||||
|
||||
final PluralAttributeMapping pluralAttribute = mutationTarget.getTargetPart();
|
||||
final CollectionPersister collectionDescriptor = pluralAttribute.getCollectionDescriptor();
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ import org.hibernate.collection.spi.PersistentCollection;
|
|||
import org.hibernate.engine.jdbc.batch.internal.BasicBatchKey;
|
||||
import org.hibernate.engine.jdbc.mutation.JdbcValueBindings;
|
||||
import org.hibernate.engine.jdbc.mutation.MutationExecutor;
|
||||
import org.hibernate.engine.jdbc.mutation.ParameterUsage;
|
||||
import org.hibernate.engine.jdbc.mutation.spi.MutationExecutorService;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.sql.model.MutationType;
|
||||
import org.hibernate.sql.model.internal.MutationOperationGroupSingle;
|
||||
import org.hibernate.sql.model.jdbc.JdbcMutationOperation;
|
||||
|
@ -32,16 +32,19 @@ public class InsertRowsCoordinatorStandard implements InsertRowsCoordinator {
|
|||
private final RowMutationOperations rowMutationOperations;
|
||||
|
||||
private final BasicBatchKey batchKey;
|
||||
private final MutationExecutorService mutationExecutorService;
|
||||
|
||||
private MutationOperationGroupSingle operationGroup;
|
||||
|
||||
public InsertRowsCoordinatorStandard(
|
||||
CollectionMutationTarget mutationTarget,
|
||||
RowMutationOperations rowMutationOperations) {
|
||||
RowMutationOperations rowMutationOperations,
|
||||
ServiceRegistry serviceRegistry) {
|
||||
this.mutationTarget = mutationTarget;
|
||||
this.rowMutationOperations = rowMutationOperations;
|
||||
|
||||
this.batchKey = new BasicBatchKey( mutationTarget.getRolePath() + "#INSERT" );
|
||||
this.mutationExecutorService = serviceRegistry.getService( MutationExecutorService.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,10 +78,6 @@ public class InsertRowsCoordinatorStandard implements InsertRowsCoordinator {
|
|||
final PluralAttributeMapping pluralAttribute = mutationTarget.getTargetPart();
|
||||
final CollectionPersister collectionDescriptor = pluralAttribute.getCollectionDescriptor();
|
||||
|
||||
final MutationExecutorService mutationExecutorService = session
|
||||
.getFactory()
|
||||
.getFastSessionServices()
|
||||
.getMutationExecutorService();
|
||||
final MutationExecutor mutationExecutor = mutationExecutorService.createExecutor(
|
||||
() -> batchKey,
|
||||
operationGroup,
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
|||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.collection.OneToManyPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.sql.model.MutationType;
|
||||
import org.hibernate.sql.model.internal.MutationOperationGroupSingle;
|
||||
import org.hibernate.sql.model.jdbc.JdbcMutationOperation;
|
||||
|
@ -34,13 +35,16 @@ public class InsertRowsCoordinatorTablePerSubclass implements InsertRowsCoordina
|
|||
private final RowMutationOperations rowMutationOperations;
|
||||
|
||||
private final SubclassEntry[] subclassEntries;
|
||||
private final MutationExecutorService mutationExecutorService;
|
||||
|
||||
public InsertRowsCoordinatorTablePerSubclass(
|
||||
OneToManyPersister mutationTarget,
|
||||
RowMutationOperations rowMutationOperations) {
|
||||
RowMutationOperations rowMutationOperations,
|
||||
ServiceRegistry serviceRegistry) {
|
||||
this.mutationTarget = mutationTarget;
|
||||
this.rowMutationOperations = rowMutationOperations;
|
||||
this.subclassEntries = new SubclassEntry[mutationTarget.getElementPersister().getRootEntityDescriptor().getSubclassEntityNames().size()];
|
||||
this.mutationExecutorService = serviceRegistry.getService( MutationExecutorService.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,11 +74,6 @@ public class InsertRowsCoordinatorTablePerSubclass implements InsertRowsCoordina
|
|||
final PluralAttributeMapping pluralAttribute = mutationTarget.getTargetPart();
|
||||
final CollectionPersister collectionDescriptor = pluralAttribute.getCollectionDescriptor();
|
||||
|
||||
final MutationExecutorService mutationExecutorService = session
|
||||
.getFactory()
|
||||
.getFastSessionServices()
|
||||
.getMutationExecutorService();
|
||||
|
||||
final Iterator<?> entries = collection.entries( collectionDescriptor );
|
||||
collection.preInsert( collectionDescriptor );
|
||||
if ( !entries.hasNext() ) {
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.hibernate.engine.jdbc.mutation.MutationExecutor;
|
|||
import org.hibernate.engine.jdbc.mutation.spi.MutationExecutorService;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.sql.model.MutationType;
|
||||
import org.hibernate.sql.model.ast.MutatingTableReference;
|
||||
import org.hibernate.sql.model.internal.MutationOperationGroupSingle;
|
||||
|
@ -30,6 +31,7 @@ public class RemoveCoordinatorStandard implements RemoveCoordinator {
|
|||
private final CollectionMutationTarget mutationTarget;
|
||||
private final OperationProducer operationProducer;
|
||||
private final BasicBatchKey batchKey;
|
||||
private final MutationExecutorService mutationExecutorService;
|
||||
|
||||
private MutationOperationGroupSingle operationGroup;
|
||||
|
||||
|
@ -41,11 +43,13 @@ public class RemoveCoordinatorStandard implements RemoveCoordinator {
|
|||
*/
|
||||
public RemoveCoordinatorStandard(
|
||||
CollectionMutationTarget mutationTarget,
|
||||
OperationProducer operationProducer) {
|
||||
OperationProducer operationProducer,
|
||||
ServiceRegistry serviceRegistry) {
|
||||
this.mutationTarget = mutationTarget;
|
||||
this.operationProducer = operationProducer;
|
||||
|
||||
this.batchKey = new BasicBatchKey( mutationTarget.getRolePath() + "#REMOVE" );
|
||||
this.mutationExecutorService = serviceRegistry.getService( MutationExecutorService.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -84,10 +88,6 @@ public class RemoveCoordinatorStandard implements RemoveCoordinator {
|
|||
operationGroup = buildOperationGroup();
|
||||
}
|
||||
|
||||
final MutationExecutorService mutationExecutorService = session
|
||||
.getFactory()
|
||||
.getFastSessionServices()
|
||||
.getMutationExecutorService();
|
||||
final MutationExecutor mutationExecutor = mutationExecutorService.createExecutor(
|
||||
() -> batchKey,
|
||||
operationGroup,
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.hibernate.metamodel.mapping.EntityMappingType;
|
|||
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
|
||||
import org.hibernate.persister.collection.OneToManyPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.sql.model.MutationType;
|
||||
import org.hibernate.sql.model.ast.MutatingTableReference;
|
||||
import org.hibernate.sql.model.internal.MutationOperationGroupSingle;
|
||||
|
@ -29,6 +30,7 @@ import static org.hibernate.sql.model.ModelMutationLogging.MODEL_MUTATION_LOGGER
|
|||
public class RemoveCoordinatorTablePerSubclass implements RemoveCoordinator {
|
||||
private final OneToManyPersister mutationTarget;
|
||||
private final OperationProducer operationProducer;
|
||||
private final MutationExecutorService mutationExecutorService;
|
||||
|
||||
private MutationOperationGroupSingle[] operationGroups;
|
||||
|
||||
|
@ -40,9 +42,11 @@ public class RemoveCoordinatorTablePerSubclass implements RemoveCoordinator {
|
|||
*/
|
||||
public RemoveCoordinatorTablePerSubclass(
|
||||
OneToManyPersister mutationTarget,
|
||||
OperationProducer operationProducer) {
|
||||
OperationProducer operationProducer,
|
||||
ServiceRegistry serviceRegistry) {
|
||||
this.mutationTarget = mutationTarget;
|
||||
this.operationProducer = operationProducer;
|
||||
this.mutationExecutorService = serviceRegistry.getService( MutationExecutorService.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,10 +80,6 @@ public class RemoveCoordinatorTablePerSubclass implements RemoveCoordinator {
|
|||
operationGroups = this.operationGroups = buildOperationGroups();
|
||||
}
|
||||
|
||||
final MutationExecutorService mutationExecutorService = session
|
||||
.getFactory()
|
||||
.getFastSessionServices()
|
||||
.getMutationExecutorService();
|
||||
final ForeignKeyDescriptor fkDescriptor = mutationTarget.getTargetPart().getKeyDescriptor();
|
||||
|
||||
for ( MutationOperationGroupSingle operationGroup : operationGroups ) {
|
||||
|
|
|
@ -12,8 +12,6 @@ import org.hibernate.collection.spi.PersistentCollection;
|
|||
import org.hibernate.engine.jdbc.batch.internal.BasicBatchKey;
|
||||
import org.hibernate.engine.jdbc.mutation.JdbcValueBindings;
|
||||
import org.hibernate.engine.jdbc.mutation.MutationExecutor;
|
||||
import org.hibernate.engine.jdbc.mutation.ParameterUsage;
|
||||
import org.hibernate.engine.jdbc.mutation.spi.MutationExecutorService;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||
|
@ -61,10 +59,6 @@ public class UpdateRowsCoordinatorOneToMany extends AbstractUpdateRowsCoordinato
|
|||
}
|
||||
|
||||
final MutationOperationGroupSingle operationGroup = resolveDeleteGroup();
|
||||
final MutationExecutorService mutationExecutorService = session
|
||||
.getFactory()
|
||||
.getFastSessionServices()
|
||||
.getMutationExecutorService();
|
||||
final MutationExecutor mutationExecutor = mutationExecutorService.createExecutor(
|
||||
() -> new BasicBatchKey( getMutationTarget().getRolePath() + "#UPDATE-DELETE" ),
|
||||
operationGroup,
|
||||
|
@ -122,10 +116,6 @@ public class UpdateRowsCoordinatorOneToMany extends AbstractUpdateRowsCoordinato
|
|||
}
|
||||
|
||||
final MutationOperationGroupSingle operationGroup = resolveInsertGroup();
|
||||
final MutationExecutorService mutationExecutorService = session
|
||||
.getFactory()
|
||||
.getFastSessionServices()
|
||||
.getMutationExecutorService();
|
||||
final MutationExecutor mutationExecutor = mutationExecutorService.createExecutor(
|
||||
() -> new BasicBatchKey( getMutationTarget().getRolePath() + "#UPDATE-INSERT" ),
|
||||
operationGroup,
|
||||
|
|
|
@ -13,8 +13,6 @@ import java.util.List;
|
|||
import org.hibernate.collection.spi.PersistentCollection;
|
||||
import org.hibernate.engine.jdbc.batch.internal.BasicBatchKey;
|
||||
import org.hibernate.engine.jdbc.mutation.MutationExecutor;
|
||||
import org.hibernate.engine.jdbc.mutation.ParameterUsage;
|
||||
import org.hibernate.engine.jdbc.mutation.spi.MutationExecutorService;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||
|
@ -32,8 +30,8 @@ import org.hibernate.sql.model.jdbc.JdbcMutationOperation;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class UpdateRowsCoordinatorStandard extends AbstractUpdateRowsCoordinator implements UpdateRowsCoordinator {
|
||||
private final RowMutationOperations rowMutationOperations;
|
||||
|
||||
private final RowMutationOperations rowMutationOperations;
|
||||
private AbstractMutationOperationGroup operationGroup;
|
||||
|
||||
public UpdateRowsCoordinatorStandard(
|
||||
|
@ -48,10 +46,6 @@ public class UpdateRowsCoordinatorStandard extends AbstractUpdateRowsCoordinator
|
|||
protected int doUpdate(Object key, PersistentCollection<?> collection, SharedSessionContractImplementor session) {
|
||||
final AbstractMutationOperationGroup operationGroup = getOperationGroup();
|
||||
|
||||
final MutationExecutorService mutationExecutorService = session
|
||||
.getFactory()
|
||||
.getFastSessionServices()
|
||||
.getMutationExecutorService();
|
||||
final MutationExecutor mutationExecutor = mutationExecutorService.createExecutor(
|
||||
() -> new BasicBatchKey( getMutationTarget().getRolePath() + "#UPDATE" ),
|
||||
operationGroup,
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.hibernate.collection.spi.PersistentCollection;
|
|||
import org.hibernate.engine.jdbc.batch.internal.BasicBatchKey;
|
||||
import org.hibernate.engine.jdbc.mutation.MutationExecutor;
|
||||
import org.hibernate.engine.jdbc.mutation.spi.BatchKeyAccess;
|
||||
import org.hibernate.engine.jdbc.mutation.spi.MutationExecutorService;
|
||||
import org.hibernate.engine.spi.EntityEntry;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
|
@ -64,11 +63,6 @@ public class UpdateRowsCoordinatorTablePerSubclass extends AbstractUpdateRowsCoo
|
|||
return;
|
||||
}
|
||||
|
||||
final MutationExecutorService mutationExecutorService = session
|
||||
.getFactory()
|
||||
.getFastSessionServices()
|
||||
.getMutationExecutorService();
|
||||
|
||||
final MutationExecutor[] executors = new MutationExecutor[deleteSubclassEntries.length];
|
||||
try {
|
||||
int entryPosition = -1;
|
||||
|
@ -157,11 +151,6 @@ public class UpdateRowsCoordinatorTablePerSubclass extends AbstractUpdateRowsCoo
|
|||
return -1;
|
||||
}
|
||||
|
||||
final MutationExecutorService mutationExecutorService = session
|
||||
.getFactory()
|
||||
.getFastSessionServices()
|
||||
.getMutationExecutorService();
|
||||
|
||||
final MutationExecutor[] executors = new MutationExecutor[insertSubclassEntries.length];
|
||||
try {
|
||||
int entryPosition = -1;
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.hibernate.engine.jdbc.mutation.JdbcValueBindings;
|
|||
import org.hibernate.engine.jdbc.mutation.ParameterUsage;
|
||||
import org.hibernate.engine.jdbc.mutation.internal.NoBatchKeyAccess;
|
||||
import org.hibernate.engine.jdbc.mutation.spi.BatchKeyAccess;
|
||||
import org.hibernate.engine.jdbc.mutation.spi.MutationExecutorService;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.generator.OnExecutionGenerator;
|
||||
|
@ -43,12 +44,16 @@ import static org.hibernate.internal.util.collections.CollectionHelper.arrayList
|
|||
*/
|
||||
@Internal
|
||||
public abstract class AbstractMutationCoordinator {
|
||||
private final AbstractEntityPersister entityPersister;
|
||||
private final SessionFactoryImplementor factory;
|
||||
protected final AbstractEntityPersister entityPersister;
|
||||
protected final SessionFactoryImplementor factory;
|
||||
protected final MutationExecutorService mutationExecutorService;
|
||||
protected final Dialect dialect;
|
||||
|
||||
public AbstractMutationCoordinator(AbstractEntityPersister entityPersister, SessionFactoryImplementor factory) {
|
||||
this.entityPersister = entityPersister;
|
||||
this.factory = factory;
|
||||
dialect = factory.getJdbcServices().getDialect();
|
||||
this.mutationExecutorService = factory.getServiceRegistry().getService( MutationExecutorService.class );
|
||||
}
|
||||
|
||||
protected AbstractEntityPersister entityPersister() {
|
||||
|
@ -60,7 +65,7 @@ public abstract class AbstractMutationCoordinator {
|
|||
}
|
||||
|
||||
protected Dialect dialect() {
|
||||
return factory().getJdbcServices().getDialect();
|
||||
return dialect;
|
||||
}
|
||||
|
||||
protected BatchKeyAccess resolveBatchKeyAccess(boolean dynamicUpdate, SharedSessionContractImplementor session) {
|
||||
|
|
|
@ -131,9 +131,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
|
|||
}
|
||||
|
||||
private MutationExecutor executor(SharedSessionContractImplementor session, MutationOperationGroup group) {
|
||||
return session.getFactory()
|
||||
.getServiceRegistry()
|
||||
.getService( MutationExecutorService.class )
|
||||
return mutationExecutorService
|
||||
.createExecutor( resolveBatchKeyAccess( false, session ), group, session );
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.hibernate.engine.jdbc.mutation.JdbcValueBindings;
|
|||
import org.hibernate.engine.jdbc.mutation.MutationExecutor;
|
||||
import org.hibernate.engine.jdbc.mutation.ParameterUsage;
|
||||
import org.hibernate.engine.jdbc.mutation.TableInclusionChecker;
|
||||
import org.hibernate.engine.jdbc.mutation.spi.MutationExecutorService;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.generator.BeforeExecutionGenerator;
|
||||
|
@ -304,9 +303,7 @@ public class InsertCoordinator extends AbstractMutationCoordinator {
|
|||
}
|
||||
|
||||
private MutationExecutor executor(SharedSessionContractImplementor session, MutationOperationGroup group, boolean dynamicUpdate) {
|
||||
return session.getFactory()
|
||||
.getServiceRegistry()
|
||||
.getService( MutationExecutorService.class )
|
||||
return mutationExecutorService
|
||||
.createExecutor( resolveBatchKeyAccess( dynamicUpdate, session ), group, session );
|
||||
}
|
||||
|
||||
|
|
|
@ -989,16 +989,12 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
|
|||
}
|
||||
|
||||
private MutationExecutor executor(SharedSessionContractImplementor session, MutationOperationGroup group, boolean dynamicUpdate) {
|
||||
return session.getSessionFactory()
|
||||
.getFastSessionServices()
|
||||
.getMutationExecutorService()
|
||||
return mutationExecutorService
|
||||
.createExecutor( resolveBatchKeyAccess( dynamicUpdate, session ), group, session );
|
||||
}
|
||||
|
||||
private MutationExecutor updateVersionExecutor(SharedSessionContractImplementor session, MutationOperationGroup group, boolean dynamicUpdate) {
|
||||
return session.getSessionFactory()
|
||||
.getFastSessionServices()
|
||||
.getMutationExecutorService()
|
||||
return mutationExecutorService
|
||||
.createExecutor( resolveUpdateVersionBatchKeyAccess( dynamicUpdate, session ), group, session );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue