Tutorials > Program model > Web services > Create a new WebSphere Commerce BOD service module

< Previous | Next >


Implement the persistence layer for the WebSphere Commerce BOD programming model

The BOD programming model provides a Data Service Layer that is independent of the actual physical schema.

Each service module (for example, Catalog and Marketing) has an independent data service implementation that contains the following assets:

  1. Static physical service data objects (SDO) that provide a Java representation of the service models view of the WebSphere Commerce schema. Each service module has a physical SDO for those tables that the service module will read, update, or delete. For example the Catalog service module contains a physical SDO for the CATALOG table but does not contain a physical SDO for the ORDER table.

    These physical SDOs are independent of the SDOs used to represent the logical model of a service module.

  2. Object-relational metadata that maps a physical SDO to the actual physical table in the WebSphere Commerce schema.

  3. Query templates that map WebSphere Commerce extended XPath notation expressions to one or more SQL template queries. These SQL template queries are used to fetch the physical data from the database. This data is represented as physical SDOs.

  4. A logical SDO (noun) to physical SDO mapping. For each logical SDO, this mapping defines the physical SDO that contains the unique ID of the noun.

  5. Business object mediators that build logical SDOs from physical SDOs and physical SDOs from logical SDOs.

    • Read Mediators: Read mediators build a logical SDO out of the physical SDO defined in the logical SDO to physical SDO mapping.

    • Change Mediators: Change mediators take a logical SDO as input and either create, update, or delete the appropriate physical SDOs. The modified physical SDOs are then saved back to the database.

WebSphere Commerce provides a tool called the Data Service Layer Wizard that automatically generates the service data objects and object-relational metadata mentioned previously. The wizard takes a list of the database tables as input and generates the object-relational mapping information and the static physical SDOs representing these tables. In the diagram below, you can see the physical SDOs:


Procedure

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

  1. If the 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 Work with a custom service module.

  5. Enter the following information:

    • Service module: Select com.mycompany.commerce.bodtutorialstore

    • Ensure that you have completed Step 8 of the Generate the TutorialStore service module projects tutorial. If this step is not completed, we will receive the following error: No custom service module is available.

    • If you do not see this service module, delete the .internal file in the com.ibm.commerce.toolkit.internal.dataaccess_7.0.0.0.jar plugin. Or, copy the com.mycompany.commerce.project from WCDE_INSTALL\workspace\Project-Server\sampleConfig\xml\config to WCDE_INSTALL\xml\config.

  6. Click Next.

  7. Select the following tables:

    • STORE

    • STOREENT

    • STOREENTDS

    • STORELANG

  8. Click Next.

  9. Click Finish.


Lesson Checkpoint

Review the assets created by the Data Service Layer wizard.

The following assets were generated:

< Previous | Next >


+

Search Tips   |   Advanced Search