Loading extension tables

Use the data load utility to load UserData into custom extension tables in your WebSphere Commerce database. There are two ways to load data into custom extension tables:

  • Map the extension table data to the logic noun UserData fields. If you need to extend the logic noun in your Management Center tool or you need to generate custom SDO extensions, use this method.
  • Use the TableObjectBuilder and TableObjectMediator to load data directly into the custom extension table. If you did not customize your Management Center tool or you did not generate custom SDO extensions, use this method.
    Feature Pack 1Note: The TableObjectMediator does not support workspace locking.

The following procedure shows you how to load data into custom extension table using the first method.

Before you begin

Read the tutorial Adding new properties to a WebSphere Commerce service using the data service layer for an example of how to create custom extension tables.

Procedure

  1. Run the Data Service Layer wizard in your development environment.
  2. Package the generated physical SDOs into a JAR file and deploy it to the WC_installdir/ext/lib directory of your runtime environment.
  3. Deploy the extension configuration directory generated by the Data Service Layer wizard into the WC_installdir/instances/instance_name/xml/config directory of your runtime environment. The generated extension configuration directory is located in the WC_eardir/xml/config directory.
  4. In your runtime environment, open the business object configuration file for the associated business objects you want to load.
  5. Add the appropriate mappings inside the <_config:DataMapping> element. For example, the following snippet shows the customization of the CatalogEntry noun to support warranty information:
    <_cat:CatalogEntry catalogEntryTypeCode="ProductBean">
          <_cat:CatalogEntryIdentifier>
            <_wcf:UniqueID>10251</_wcf:UniqueID>
            <_wcf:ExternalIdentifier ownerID="7000000000000000101">
            <_wcf:PartNumber>FULO-01</_wcf:PartNumber>
            </_wcf:ExternalIdentifier>
          </_cat:CatalogEntryIdentifier>
          <_cat:Description language="-1">
            <_cat:Attributes name="careinstruction">Warranty care instructions.</_cat:Attributes>
          </_cat:Description>
          <_wcf:UserData>
            <_wcf:UserDataField name="warterm">30</_wcf:UserDataField>
            <_wcf:UserDataField name="wartype">LIMITED</_wcf:UserDataField>
          </_wcf:UserData>
    </_cat:CatalogEntry>

    The catalog entry mediator supports loading custom catalog entry UserData using the catalog entry mediator. You do not need to create a custom mediator to support UserData.

    Add the following code in the business object configuration file to map the warranty userdata:

    <_config:mapping xpath="UserData/UserDataField/warterm" value="WarrantyTerm" />
    <_config:mapping xpath="UserData/UserDataField/wartype" value="WarrantyType" />
    <_config:mapping xpath="Description/Attributes/careinstruction" value="CareInstruction"  />
  6. Save and close the file.
  7. Run the Data Load utility.