Interface CollectionMutationPlanContributor
Contributes state-management-specific collection mutation plans for graph queue decomposition.
The collection decomposer is responsible for discovering collection deltas and assigning stable graph ordinals. This contract is responsible for changing how those logical deltas are modeled for a specific state-management strategy. For example, single-table temporal state management replaces physical row deletes with temporal end-row updates and models value changes as end plus insert instead of in-place update.
Contributors may replace the JDBC mutation plan for row delete and remove-all operations and may
contribute their own flush operations for value changes. When a contributor replaces remove-all
SQL, it can also bind any strategy-specific assignment values through
bindRemoveValues(RemoveBindContext, JdbcValueBindings).
- Since:
- 8.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordContext passed tocontributeCollectionChange(CollectionChangeContext, Consumer).static final recordContext passed tobuildDeleteRowPlan(DeleteRowPlanContext, Supplier).static final recordContext passed tobindRemoveValues(RemoveBindContext, JdbcValueBindings).static final recordContext passed tobuildRemoveOperation(RemoveOperationContext, Supplier).static final recordContext passed tocontributeAdditionalInsert(RowInsertContext, Consumer).static final recordContext passed tocontributeValueChange(ValueChangeContext, Consumer). -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CollectionMutationPlanContributorThe contributor used by the standard state-management model. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidbindRemoveValues(CollectionMutationPlanContributor.RemoveBindContext context, JdbcValueBindings valueBindings) Binds parameter values for a remove-all collection operation.buildDeleteRowPlan(CollectionMutationPlanContributor.DeleteRowPlanContext context, Supplier<CollectionJdbcOperations.DeleteRowPlan> standardPlanSupplier) Optionally replaces the mutation plan for deleting a single collection row.default MutationOperationbuildRemoveOperation(CollectionMutationPlanContributor.RemoveOperationContext context, Supplier<MutationOperation> standardOperationSupplier) Optionally replaces the mutation operation for removing all rows for a collection key.default voidcontributeAdditionalInsert(CollectionMutationPlanContributor.RowInsertContext context, Consumer<FlushOperation> operationConsumer) Optionally contributes extra operations for a single logical row insertion.default voidcontributeCollectionChange(CollectionMutationPlanContributor.CollectionChangeContext context, Consumer<FlushOperation> operationConsumer) Optionally contributes operations or callbacks for a logical collection change.default booleancontributeValueChange(CollectionMutationPlanContributor.ValueChangeContext context, Consumer<FlushOperation> operationConsumer) Optionally replaces the flush operations for an in-place collection value change.
-
Field Details
-
STANDARD
The contributor used by the standard state-management model. It does not contribute any alternate collection mutation plans.
-
-
Method Details
-
buildDeleteRowPlan
default CollectionJdbcOperations.DeleteRowPlan buildDeleteRowPlan(CollectionMutationPlanContributor.DeleteRowPlanContext context, Supplier<CollectionJdbcOperations.DeleteRowPlan> standardPlanSupplier) Optionally replaces the mutation plan for deleting a single collection row.
The supplied table descriptor is the physical table being mutated by the decomposer. For table-per-subclass one-to-many collections this may be a concrete entity table descriptor rather than the collection table descriptor.
- Parameters:
context- Details needed to build the row-delete mutation plan.standardPlanSupplier- Supplies the decomposer's normal row-delete plan.- Returns:
- The row-delete plan to use for this collection table shape.
-
buildRemoveOperation
default MutationOperation buildRemoveOperation(CollectionMutationPlanContributor.RemoveOperationContext context, Supplier<MutationOperation> standardOperationSupplier) Optionally replaces the mutation operation for removing all rows for a collection key.
The returned operation is used by the decomposer's remove-all
FlushOperation. Contributors which add assignment parameters to the replacement operation should also overridebindRemoveValues(RemoveBindContext, JdbcValueBindings).- Parameters:
context- Details needed to build the remove-all mutation operation.standardOperationSupplier- Supplies the decomposer's normal remove-all operation.- Returns:
- The remove-all mutation operation to use, or
nullif no SQL operation is needed.
-
contributeValueChange
default boolean contributeValueChange(CollectionMutationPlanContributor.ValueChangeContext context, Consumer<FlushOperation> operationConsumer) Optionally replaces the flush operations for an in-place collection value change.
A contributor should return
trueonly when it has emitted the complete operation set for the value change. Returningfalselets the decomposer emit its standard update-row operation.- Parameters:
context- Details of the logical value change.operationConsumer- Consumer for contributed flush operations.- Returns:
trueif the contributor fully handled the value change;falseotherwise.
-
contributeAdditionalInsert
default void contributeAdditionalInsert(CollectionMutationPlanContributor.RowInsertContext context, Consumer<FlushOperation> operationConsumer) Optionally contributes extra operations for a single logical row insertion.
This hook is row-scoped. It is suitable for strategies that need to mirror or augment each inserted row, such as inserting a history-table row. Contributors that only need to observe the whole collection action should usually use
contributeCollectionChange(CollectionChangeContext, Consumer).- Parameters:
context- Details of the inserted logical collection row.operationConsumer- Consumer for contributed flush operations.
-
contributeCollectionChange
default void contributeCollectionChange(CollectionMutationPlanContributor.CollectionChangeContext context, Consumer<FlushOperation> operationConsumer) Optionally contributes operations or callbacks for a logical collection change.
This hook is action-scoped rather than row-scoped. It is called when a decomposer has detected work for the collection action and is intended for contributors that need to record or defer whole-collection state changes, such as audit collection-change collection.
- Parameters:
context- Details of the logical collection change.operationConsumer- Consumer for contributed flush operations.
-
bindRemoveValues
default void bindRemoveValues(CollectionMutationPlanContributor.RemoveBindContext context, JdbcValueBindings valueBindings) Binds parameter values for a remove-all collection operation.
The default implementation binds the collection key as a restriction. A contributor that replaces remove-all SQL with an update, such as single-table temporal state management, may bind assignment values before or after delegating to this default implementation.
- Parameters:
context- Details of the remove-all binding.valueBindings- Binding target for JDBC values.
-