Understanding > WebSphere Commerce and service-oriented architecture (SOA) > Data service layer

Commerce Feature Pack


Business Object Mediator

The Business Object Mediator (BOM) performs bidirectional transformations between the physical SDOs and logical SDOs. By performing this role, it provides a business object persistence interface for the data service layer. The BOM supports create, read, update, delete operations on the logical SDOs so that the business logic layer can work with them rather than the physical schema.

In WebSphere Commerce, before Feature Pack 3, business logic deals with EJBs directly. While these beans are relatively easy to manipulate, the drawback is that these beans are a direct mapping to the physical schema, which complicates extension and customization. Using EJBs directly also ties the business logic to the persistence technology. As WebSphere Commerce moves to SOA and continues to extend its support of Web service clients, a logical model of service data objects (SDOs) has been defined for the business logic to use. The objects in this logical model, the logical SDOs, are the data interchange mechanism for inter-component interaction as well as Web service interactions.

There is also a set of service data objects used by the persistence layer, called physical SDOs. Physical SDOs are Java objects that represent the physical schema. The Business Object Mediator provides the mapping between these logical SDOs, and their counterparts in the persistence layer, the physical SDOs.

As part of the transformation process, the Business Object Mediator uses the services of the Physical Data Container to fetch and save the physical data. The Physical Data Container manages the actual work of interacting with the physical schema. The Physical Data Container manages physical SDOs – it can create them, store arrays of them, and save them to the database.

As shown in the diagram above, there are two ways of persisting data through the data service layer. The most common approach is to call the Business Object Mediator to transform your logical SDOs to physical SDOs. However, the business logic commands may occasionally need to work with physical objects directly, because they are not mapped to the logical model. For example, tables that are used to keep audit logs or statistics. In cases like these, the business logic layer can make use the Physical Data Container to read and write data directly to the database.

Read and change mediators

The Data Service Layer initializes the Business Object Mediators. These are classes that transform between the logical and physical representations of the domain model. This allows the business logic layer to deal only with the logical representation of the data. Each service module provides its own implementation for the mediators.

Each service module provides its own mediators, and there are two kinds: Read and Change mediators. They are listed in the Business Object Mediator configuration file. Read mediators are used to process the OAGIS Get requests. Change mediators handle the OAGIS Change, Process and Sync requests.

For read operations, the data service layer facade receives a query from the business logic layer. The query consists of an XPath expression and an access profile, which are extracted from the OAGIS GET verb. The data service layer forwards this query to the business object mediator (BOM) who, in turn, passes it to the persistence service. That service looks up the correct SQL template for the query, and uses it to generate one or more SQL statements. It then runs these statements, and maps their result sets into physical SDOs. This mapping, between the database schema (tables and columns) and the SDO classes, is defined by XML called Object-relational metadata. Finally, the physical SDOs are returned to the BOM. The BOM configuration describes how to instantiate the necessary mediators, which are returned to the business logic layer. Note that the mediator is returned, not just the SDO. The mediator contains the physical SDO data. It also contains the logic to convert the physical SDO to the logical SDO (which is the Java representation of an OAGIS noun).

For change operations (create, update, delete), the data service layer facade receives the OAGIS nouns as input, and passes them to the business object mediation service. This service instantiates the appropriate change mediators. In turn, they fetch the physical representation of the nouns from a service called the physical object mediation service. The BOM then returns the mediators to the business logic layer. The mediators are then called with specific actions to create, update, or delete nouns and noun parts. The logic inside the mediators translates these actions into operations on physical SDOs. For example, a create request will create new physical objects and populate them with noun values. After making all its changes, the business logic layer instructs the change noun mediator to save the updated physical SDOs. The mediator calls a physical object persistence service to update the database.

Related concepts

Data service layer

Physical data container

Related tasks

Building object-relational metadata and Physical Service Data Objects to reflect schema changes using the Data Service Layer Wizard

Configure the Business Object Mediator

Last updated: 25 November 2009