Tutorial: Extending a BOD service to manage UserData with the data service layer

In this tutorial, you customize the catalog service to support retrieving UserData information for use as catalog entry properties. This customization updates the WebSphere Commerce database to store the new information and customizes the catalog service to support the new information. The new information is included as UserData in the CatalogEntry noun.
In this tutorial, you customize the catalog service to support new catalog entry properties for warranty and care instruction information. This tutorial works with the WebSphere Commerce BOD programming model, the CatalogEntry noun, and the CatalogEntryDescription noun to complete this customization. You must configure the business object mediator to populate warranty information as UserData in the CatalogEntry noun and populate care instruction information as attributes in the CatalogDescription noun part. You then create a custom query template file to map an XPath expression and access profile to SQL. This template file performs the following tasks:
  1. Defines an SQL template statement that fetches data from the new tables.
  2. Associates a new access profile to the new SQL template statement.
  3. Associates an XPath expression to the new SQL template statement.

The WebSphere Commerce BOD programming model separates processing into the business logic layer and the persistence layer. The business logic layer works with logical service data objects (SDOs), which are the Java representation of nouns. The persistence layer creates, reads, updates, or deletes business objects in the WebSphere Commerce database. This separation allows adding new data to affect only the persistence layer.

The CatalogEntry noun uses the UserData element as a data extension point to add new data without changing the logical model. In this tutorial, warranty information is added to the CatalogEntry noun UserData element to demonstrate the addition of language-dependent properties. For this tutorial, a warranty applies to a specific catalog entry and consists of a number of days the warranty applies and a warranty type: either limited or comprehensive.

The catalog description noun part supports the attributes element as a data extension point. Attributes provide the same functions as the UserData element. Product care instructions are added to the CatalogEntryDescription noun part attributes element to show the addition of language independent properties. In this tutorial, a care instruction applies to a specific catalog entry and language and consists of a text description of the instruction.

Note: Workspaces are not supported when you are completing this tutorial.

Learning objectives

After completing this tutorial, you should be familiar with the following concepts:
  • Understanding the WebSphere Commerce data service layer
  • Overview of simple extension and customization tasks.
After completing this tutorial, you should be able to perform the following tasks:
  • Updating the WebSphere Commerce database with new tables and relationships.
  • Generating custom object-relational metadata that describe new tables and relationships.
  • Generating static service data objects (SDO) that provide a Java representation of the newly added tables.
  • Configuring the logical DataObject to physical DataObject mapping.
  • Creating a custom query template file to map an XPath expression and access profile to SQL.

Time required

Expect this tutorial to take one hour to complete. The tutorial takes longer if you explore concepts that are related to this tutorial.

Skill level

This tutorial is intended for advanced WebSphere Commerce developers responsible for creating and customizing WebSphere Commerce BOD services. To complete this tutorial, ensure that you are familiar with the following terms and concepts:
  • Web services
  • XML
  • WebSphere Commerce services
  • Relational databases
  • SQL

Tutorial resources

You can download and review a compressed file that contains the code samples that are used in this tutorial. Download and extract this file to a temporary directory, such as C:\Temp: