Scenario: Catalog entry update load

You can configure the Data Load utility to run in an update mode to update catalog entry information. The update mode compares the catalog entry data in the input file with the corresponding data for the catalog entries in the database. The update mode then replaces or adds data for only the columns that are specified in the input file. All other columns remain unchanged.

When you run the Data Load utility in replace mode, the Data Load utility assumes that the input file is a new master copy of the data for the objects within the file. During a load operation, the utility replaces any data in the database with the input file data. If the input file does not include data to load into a database column, the utility loads the default value for the column if a value is configured. If no value exists in the input file and no default value is configured, the utility deletes the data in the corresponding database column for the object.

With the Data Load utility in replace mode, administrators must include data for all columns to prevent the load process from deleting data from the database or resetting the data to a default value. You can also configure a column exclusion list to prevent the utility from updating specific columns, but the utility can still erase data if values are missing for an object for any column that is not excluded.

The Data Load utility update mode prevents the utility from deleting data in the database when column values are missing for catalog entry objects in the input file. You do not need to configure any column exclusion list. To configure the update mode, you must set the value "Update" for the load order configuration file property, dataLoadMode. For example,
<_config:LoadOrder dataLoadMode="Update" >
You can also include the dataLoadMode property in the configuration for specific load items, for example:
<_config:LoadItem name="CatalogEntryUpdate" dataLoadMode="Update">
You can use the Data Load utility in update mode for loading catalog entry and catalog entry description information. To help you use the utility in update mode, sample configuration files are available for you to use. These configuration files are in the following directory:
  • LinuxAIXWC_installdir/samples/DataLoad/Catalog/CatalogEntryUpdate
  • WindowsWC_installdir\samples\DataLoad\Catalog\CatalogEntryUpdate
  • WebSphere Commerce DeveloperWCDE_installdir\samples\DataLoad\Catalog\CatalogEntryUpdate
If you customize the configuration files to load data other than catalog entry or catalog entry description information, the load operation might not work as expected.

When the Data Load utility runs in update mode, the business object mediator sends a list of table data objects to the JDBCDataWriter. These data objects include the input file values. The data writer can then persist the table data objects to the database. For each object, the data writer retrieves the corresponding database row and compares the column values between the database and the data object. If a value is different, the data writer replaces the value in the database with the value in the table data object. If the values are the same or no value exists in the table data object, no update occurs. The existing database column value remains.

Catalog Upload

Business users can also use the Catalog Upload in update mode to upload catalog entry and catalog entry description information into the Catalogs tool. If you must provide business users with CSV or XML files to use for uploading data, ensure that you include the correct keywords within the input files. To upload catalog entry information in update mode, the CSV or XML file, use one of the following keywords:
CatalogEntryUpdate
Indicates that the upload includes updates for catalog entry data, such as name or manufacturer name.
CatalogEntryDescriptionUpdate
Indicates that the upload includes updates for catalog entry descriptive data, such as short description or long description.
If you include keywords in the CSV or XML file, you can use the file as the input file for both the Catalog Upload feature or the Data Load utility.

Sample

The following code snippet is part of a sample wc-dataload.xml data load order configuration file. This snippet specifies the Update data load mode, a small commit count, and batch size, and without a fixed keyrange:
<_config:LoadOrder commitCount="10" batchSize="1" dataLoadMode="Update" >
  <_config:property name="firstTwoLinesAreHeader" value="true" />
  <_config:LoadItem name="CatalogEntryUpdate" loadSequence="3.1" businessObjectConfigFile="wc-loader
   -catalog-entry-update.xml">
    <_config:DataSourceLocation location="CatalogEntriesUpdate.csv" oldLocation="" />
    <_config:BusinessContext languageId="-1"/>
  </_config:LoadItem>
</_config:LoadOrder>
This sample sets the dataLoadMode in only the load order configuration, but you can also set it within the load item configuration.
The following code snippet is part of a sample wc-dataload-env.xml data load environment configuration file. This snippet specifies the ID resolver cache size to 0:
<_config:IDResolver className="com.ibm.commerce.foundation.dataload.idresolve.IDResolverImpl" 
cacheSize="0" />