Customizing the physical layer to include the new information
In this lesson you are customizing the physical layer by modifying the WebSphere Commerce schema, generating object-relational metadata, and generating physical service data objects (SDOs). To do so, you use a tool called the Data Service Layer wizard.
About this task
The Data Service Layer wizard is used to generate object-relational metadata and physical data objects for your schema customization. Physical SDOs are service data objects that represent tables in the WebSphere Commerce schema. Each data object type corresponds to a table definition in the schema, and each data object property corresponds to a table column or a reference to another DataObject type. These references correspond to the foreign key relationships between the database tables.
For each service module, there is object-relational metadata that contains the information to relate the physical DataObject to a database table. Custom object-relational metadata is stored in the component configuration extension directories and custom physical SDOs are stored inside the WebSphereCommerceServerExtensionsLogic project.
- Creates an extension configuration folder for the Catalog service
module if one does not exist. The directory path is:
WC_eardir\xml\config\com.ibm.commerce.catalog-ext.
- Generates a custom object-relational metadata file that describes
the new custom tables and relationships. In this tutorial, the metadata
file describes the two new tables, XWARRANTY and XCAREINSTRUCTION,
along with the three new relationships between tables:
- XWARRANTY and CATENTRY
- XCAREINSTRUCTION and CATENTRY
- XCAREINSTRUCTION and CATENTDESC
WC_eardir\xml\config\com.ibm.commerce.catalog-ext\wc-object-relational-metadata.xml
.Note: The wc-object-relational-metadata.xml file maps the database tables and columns to physical SDOs.For example, the following snippet of the XWARRANTY configuration as generated by the DSL wizard in this tutorial:
Where the column CATENTRY_ID is mapped to the field catentry_id in the XWarranty Java class.<_config:table name="XWARRANTY" occColumnName="OPTCOUNTER" propertyName="Xwarranty"> <_config:column name="CATENTRY_ID" nullable="false" primaryKey="true" propertyName="catentry_id" type="BIGINT"/>
- Generates an SDO Java class and places it in the WebSphereCommerceServerExtensionsLogic
project for:
- Each new custom table (XWARRANTY and XCAREINSTRUCTION).
- Each modified WebSphere Commerce table (CATENTRY and CATENTDESC were modified by adding new relationships to the custom tables).
- Creates a utility Java class to return the physical SDO root class (and its package) for the service module. This root class ensures that all WebSphere Commerce physical SDOs for the Service Module, and any additional physical SDOs for the customization, are available at run time.
- Creates an extension service module configuration file that instructs
WebSphere Commerce to use the newly created catalog physical SDO class
in
WC_eardir\xml\config\com.ibm.commerce.catalog-ext\wc-component.xml
. - Creates an extension business object mediator configuration file.
This file configures the business object mediator to include data
from the XWARRANTY and XCAREINSTRUCTION tables in the user data of
a CatalogEntry noun. This file location is
WC_eardir\xml\config\com.ibm.commerce.catalog-ext\wc-business-object-mediator.xml
.
Procedure
Results
If the code generated by the Data Service Layer produces an error, for example, CatalogEntityPackage cannot be resolved, selecting
can resolve the issue.