(Developer)

Build metadata and data objects to reflect Data Service Layer schema changes

The WebSphere Commerce Data Service Layer Wizard generates the physical service data objects (SDO) Java classes for a customization. This Wizard also generates the required object-relational metadata and configuration for business object mediators. If we create a database table or develop new service modules, we must build the required object-relational metadata and physical SDOs with the Data Service Layer Wizard to reflect your schema changes.


Before starting

The schema contains the new tables for which the physical SDO Java classes and object-relational mapping are needed.


About this task

This task describes how to use the Data Service Layer Wizard to add object-relational metadata and generate the physical SDO classes for a customized schema. The XML assets that you generate are stored in the service module configuration extension directories. The custom physical SDO Java classes that you generate are stored inside the WebSphereCommerceServerExtensionsLogic project. With this wizard, we can perform the following tasks:

Note: We must use supported database column data types in our custom tables. If you use unsupported data types, tools such as the Data Service Layer Wizard and the staging environment can encounter errors.

Reading the log file that is generated by the Data Service Layer Wizard

The Data Service Layer Wizard .log file is in the RAD_INSTALL/workspace/.metadata directory. The size of this file can be large due to the generation of many lines of information into the log file by the eclipse plug-ins. While this file can contain a large amount of information, we can determine the relevance of each message by observing the Plugin ID. This ID serves as a prefix to all messages contained in the log.

To determine which messages are relevant to the Data Service Layer Wizard, observe all messages which are prefixed by the Plugin ID com.ibm.commerce.toolkit.internal.dataaccess in the log file.


Procedure

Use the Data Service Layer wizard to generate object-relational metadata and physical data objects that represent the customized schema.

  1. If your development environment uses an Apache Derby database, ensure that there is no existing connection to it. For example, ensure that the WebSphere Commerce Server is stopped).

  2. Select File > New > Other > WebSphere Commerce > Data Service Layer .

  3. Click Next.

  4. Select Extend a default WebSphere Commerce service module or Work with a custom service module.

  5. Enter the required information. In Service module , select the name of the module for which we are building SDOs. In Extension class prefix, enter a string used to prefix all classes that are generated. In Extension Java package name, enter the name of the package containing the SDOs. For example, if we are extending the catalog schema, the values would be as follows:

    • Service module: Select com.ibm.commerce.catalog

    • Extension class prefix: MyCompany

    • Extension Java package name: com.mycompany.commerce.catalog

  6. Click Next.

  7. Select the custom tables that you added to the schema.

  8. Under each table you have selected, select the columns we want to include in the SDO class. Primary key columns, non-nullable columns, and the OPTCOUNTER column are automatically selected. Primary key columns are not available, because we must include them in the SDO.

  9. Click Next.

  10. On the Metadata Editing panel, we can choose what columns we want to include in the UserData area of the logical schema. Click the UserData column to set the value to true or false for the columns we want to include.

  11. (Oracle) If you use the Oracle NUMBER data type in a custom table, we must choose a more granular data type to map to. The Oracle NUMBER data type can represent different multiple types, including integer, float, and double. Using the drop-down list in the Datatype column, choose the appropriate mapping.

  12. Click Finish.