If the operation in the InteractionSpec is ApplyChanges, and the
verb does not exist in the business graph, the adapter performs the DeltaUpdate
operation. The adapter inspects the ChangeSummary to identify the operation
for each business object in the input hierarchy and performs the operation
that was identified.
DeltaUpdate operations are different from Update operations as
follows:
- In a DeltaUpdate operation, no retrieve operation occurs before updating.
- No comparisons are made between the incoming business object and the business
object in the database.
- All children are processed based on the verb set in each child object.
If a child does not have a verb set in it, the adapter returns an error.
The adapter performs the following steps when updating a hierarchical
business object with DeltaUpdate. It processes only object changes from the
ChangeSummary:
- It recursively processes all single-cardinality children of the parent
object. If a child is marked required in the business object specification,
it must be present in the inbound object. If it is not, the DeltaUpdate operation
fails, and the adapter returns an error.
- It sets all foreign key values in the parent that reference attributes
in single-cardinality children to their corresponding child values. This is
necessary because single-cardinality children might have been added to the
database during the previous steps, resulting in the generation of new sequence
values.
- It updates the current object being processed using an SQL Update statement
or a stored procedure. All simple attributes of the individual business object
are updated. The adapter does not use property level changes
to determine which attributes need to be added to the update statement; they
are all updated. Because the object being updated should be unique, the adapter
checks to ensure that only one row is processed as a result. An error is
returned if more than one row is processed.
- It sets all foreign key values in all cardinality N children of the current
object that reference parent attributes to the corresponding parent values.
Usually these values are already cross-referenced during data mapping; however,
this might not be the case for new children in cardinality N containers. This
step ensures that the foreign-key values in all cardinality N children are
correct before those children are updated.
- It updates all cardinality N containers of the current object.
When
the child objects are processed, each child’s verb is taken and the appropriate
operation is performed. The allowed operations on a child in DeltaUpdate are
create, delete, and update:
- If a Create verb is found in the child, the child is created in the database
if it is an ownership child. Non-ownership children are retrieved to validate
their existence in the database.
- If a Delete verb is found in the child, that child is deleted.
- If an Update verb is found in the child, the child gets updated in the
database.