Understanding > WebSphere Commerce and service-oriented architecture (SOA) > Data service layer
Commerce Feature Pack
Physical data container
The physical data container supports create, read, update, delete) operations on the physical SDOs, which are mapped directly to the physical schema. It also enables the business logic to work with physical SDOs that are not mapped to the logical model – for example, statistics or auditing data.
An instance of the PhysicalDataContainer can be used to:
- Retrieve a collection of physical data objects corresponding to the query associated with this instance, using the getPhysicalObjects() method.
- Persist changes made by the caller to these physical data objects.
- Create and delete objects using the createPhysicalObject() and removePhysicalObject() methods.
- Generate a primary key using getNextPrimaryKey() method.
- Get paging information:
- getPagingTotal()
- Returns the total number of results for a paging search
- getPagingRecordSetCompleteIndicator()
- Indicates if you have reached the last page of the paging search.
- getPagingRecordSetStartNumber()
- Returns the starting record number which the caller passed in.
- Saves any changes made to the data objects, by using the PhysicalDataContainer.save() method.
Each service module can obtain a service module-specific instance of the DataServiceFacade object via the static getInstance() method and then get an instance of the PhysicalDataContainer for a given query. The DataServiceFacade provides a single front to the persistence layer for a service module. The client can either work with physical data objects directly, or use the business object mediators to transform nouns and noun parts to and from the database in a consistent way.
Key management
Whenever you create a new physical SDO, initialize the value of the primary key on the SDO. You use the physical data container to get the next primary key for a given class, by calling the getNextPrimaryKey(Class aClass) method. This method gets the unique key for a database table represented by the given class. The mapping between the physical table name and class name is defined by the object-relational mapping, as described in Object-relational metadata.
Related concepts
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