SAP Commerce DB Sync does support deletions. It can be enabled for the transactional table using two different approaches:
- Default Approach using After Save Event Listener
- Alternative approach using Remove Interceptor
After Save Event Listener, which will be enabled for the limited type code and only in a constraint violation.
- Activate the After save listener by defining the implementation of AfterSaveListener interface.
<bean id="defaultCMTAfterSaveListener" class="org.sap.commercemigration.listeners.DefaultCMTAfterSaveListener">
<property name="modelService" ref="modelService" />
<property name="typeService" ref="typeService" />
</bean>
- Configurable property for the list of type codes where we should manage deletion
# Provide the typecodes in comma seperated
migration.data.incremental.deletions.typecodes=4,30
migration.data.incremental.deletions.typecodes.enabled=true
- Dedicated item type for deleted records (separate table with PK).
For now, it is supported through **ItemDeletionMarker**.
- Deletion activity is tied with incremental to avoid duplicates.
Disclaimer: It will not support for the direct deletions via DB or JDBC Template. When SAP Commerce server is stopped, events published in the queue and that have not been handle by AfterSaveEventPublisher threads are lost.
When a transaction is committed, an after save event is either added to a blocking queue in case of asynchronous mode or notify directly After Save Listeners in case of synchronous mode.

The pool of AfterSaveEventPublisherThread is managed by DefaultAfterSaveListenerRegistry, each thread drains the blocking queue of after send event and call After Save Listeners.
Here are the DefaultAfterSaveListenerRegistry tuning parameters:
core.aftersave.async=true //default true (asynchronous mode)
core.aftersave.interval=200 //sleep time in ms
core.aftersave.batchsize=1024 //draining batch size
core.aftersave.queuesize=1024 //maximum elements in the queue before blocking
Note: It is disabled by default, only enable if you face difficulties with after save listener approach.
Remove Interceptor which will be enabled for the limited ItemTypes and only in a constraint violation.
- Activate the Delete Interceptor by defining an InterceptorMapping for each tracked item type.
class="de.hybris.platform.servicelayer.interceptor.impl.InterceptorMapping">
<property name="interceptor" ref="defaultCMTRemoveInterceptor"/>
<property name="typeCode" value="Item" />
</bean>
- Configurable property for the list of type codes where we should manage deletion
# Provide the itemType for deletions
migration.data.incremental.deletions.itemtype=Media,Employee
migration.data.incremental.deletions.itemtypes.enabled=true
- Dedicated item type for deleted records (separate table with PK).
For now, it is supported by ItemDeletionMarker.
- Deletion activity is tied with incremental to avoid duplicates.
Disclaimer: Deletions will work with SL (legacy sync, legacy Impex, Service Layer Direct)
- Not required to be enabled for all the tables and few use-cases could be considered
- In case of Constraint validation failure
- Deletion is triggered by application, e.g. removing the entry from a cart.
- Don't enable for audit table or task logs
- It is covering deletions and migration together to avoid constraint validation.
- It can be toggle through properties.
