Data load fails on soft delete error with actionOnError configured

When you load data to delete objects and the actionOnError property is enabled, a load operation can still fail when a soft delete error occurs. This load operation failure can occur when you do not enable the actionOnError for all mediators and do not define the delete mapping for all mediators.

Problem

When you load data to delete objects from the database and you are using multiple mediators to delete the objects, the data load operation fails on soft deletes. A soft delete error occurs when the load operation attempts to delete a non-existent object or value. This failure occurs even though the actionOnError configuration property is specified to configure the load process to skip to the next record when a soft delete error occurs. Instead, the Data Load utility throws an exception and exits the load operation.

Example

You are deleting catalog entries that are indexed by WebSphere Commerce search. To delete the catalog entries with the Data Load utility, you load an input file that includes the delete column with a value of for each catalog entry. This delete column value indicates that the load operation is to delete the catalog entries. To delete the catalog entries and update the search index, you configure the utility to use the CatalogEntryMediator and CatalogEntrySearchIndexMediator business object mediators. During the load operation, a soft delete error occurs when a record in your file does not exist in the database. The Data Load utility then throws an exception and the load operation fails. To prevent the load operation from failing due to the soft delete error, you enable the actionOnError property and rerun the Data Load utility. When the soft delete error occurs again, the utility still throws an exception and the load operation fails.

Solution

Enable the actionOnError property for all mediators and configure the XPath mapping for the delete column for all mediators. By enabling the actionOnError property for every mediator, you can control the error handling for the overall load operation. If you enable the property for only one mediator and the utility also uses other mediators, the actionOnError property does not affect the error handling for the other mediators. If you do not include the delete column XPath mapping for a mediator, that mediator is not properly configured to delete objects. The actionOnError property then does not apply to that mediator during a delete operation. Since the property is not enabled for all mediators, the property does not affect the error handling for the overall operation and the operation can fail when a soft delete error occurs.

To include the XPath mapping for the delete column, include the following configuration mapping in the business object configuration file for the business object:
<_config:mapping xpath="" value="Delete" deleteValue="1" />
To enable the actionOnError property for the overall load operation, include the following configurable property and value in the configuration for each mediator:
<_config:property name="actionOnError" value="1"/>
For example, the following configuration for the CatalogEntryMediator and CatalogEntrySearchIndexMediator business object mediators includes the delete column XPath mappings and enables the actionOnError property for both mediators.

<_config:BusinessObjectBuilder className="com.ibm.commerce.foundation.dataload.businessobjectbuilder.BaseBusinessObjectBuilder" 
  packageName="com.ibm.commerce.catalog.facade.datatypes.CatalogPackage" dataObjectType="AttributeDictionaryAttributeType" >
  <_config:DataMapping>
    ...
    <_config:mapping xpath="" value="Delete" deleteValue="1"/>
  </_config:DataMapping>
  <_config:BusinessObjectMediator className="com.ibm.commerce.catalog.dataload.mediator.CatalogEntryMediator" componentId="com.ibm.commerce.catalog">
    <_config:property name="actionOnError" value="1" />
  </_config:BusinessObjectMediator>
</_config:BusinessObjectBuilder>

<_config:BusinessObjectBuilder className="com.ibm.commerce.foundation.dataload.businessobjectbuilder.BaseBusinessObjectBuilder" 
  packageName="com.ibm.commerce.catalog.facade.datatypes.CatalogPackage" dataObjectType="AttributeDictionaryAttributeType" >
  <_config:DataMapping>
    ...
    <_config:mapping xpath="" value="Delete" deleteValue="1"/>
  </_config:DataMapping>
  <_config:BusinessObjectMediator className="com.ibm.commerce.catalog.dataload.mediator.CatalogEntrySearchIndexMediator" componentId="com.ibm.commerce.catalog">
    <_config:property name="actionOnError" value="1" />
  </_config:BusinessObjectMediator>
</_config:BusinessObjectBuilder>