IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Services and service-related functions > Access external services with adapters > Configure and using adapters > IBM WebSphere Adapters > JDBC > Overview of IBM WebSphere Adapter for JDBC > Technical overview > Outbound processing > Outbound operations

Update operation

The Update operation is performed by comparing the source business object with a business object that is retrieved from the database using the primary keys specified in the top-level, source business object.

When updating a hierarchical business object, the adapter performs the following actions:

  1. Uses the primary key values of the source business object to retrieve the corresponding entity from the database. The retrieved business object is an accurate representation of the current state of the data in the database.

    If the retrieval fails, indicating that the top-level business object does not exist in the database, the adapter returns a RecordNotFoundException error, and the update fails.

    If the retrieval succeeds, the adapter compares the retrieved business object to the source business object to determine which child business objects require changes in the database. The adapter does not, however, compare values in the source business objects simple attributes to those in the retrieved business object. The adapter updates the values of all non-key simple attributes.

    If all of the simple attributes in the top-level business object represent keys, the adapter cannot generate an update query for the top-level business object. In this case, the adapter logs a warning and continues.

  2. Recursively updates all single-cardinality children of the top-level business object.

    If the business object definition requires that an attribute represent a child business object, the child must exist in both the source business object and the retrieved business object.

    If it does not, the Update operation fails, and the adapter returns an error.

    The adapter handles single-cardinality children contained with ownership in one of the following ways:

    • If the child is present in both the source and the retrieved business objects, instead of updating the existing child in the database, the adapter deletes the existing child and creates a new child.

    • If the child is present in the source business object but not in the retrieved business object, the adapter recursively creates the child in the database.

    • If the child is present in the retrieved business object but not in the source business object, the adapter recursively deletes the child from the database.

    For single-cardinality children contained without ownership, the adapter attempts to retrieve every child from the database that is present in the source business object. If it successfully retrieves the child, the adapter populates the child business object but does not update it, because the adapter never modifies single-cardinality children contained without ownership.

  3. Updates all simple attributes of the retrieved business object, except those whose corresponding attribute in the source business object is not specified.

    Because the business object being updated must be unique, the adapter verifies that only one row is processed as a result. It returns an error if more than one row is returned.

    If the top-level business object is a wrapper business object, it is ignored. No update is done for wrapper business objects.

  4. Processes each multiple-cardinality child of the retrieved business object in one of the following ways:

    • If the child exists in both the source and the retrieved business objects arrays, the adapter recursively updates it in the database.

    • If the child exists in the source array but not in the array of the retrieved business object, the adapter recursively creates it in the database.

    • If the child exists in the array of the retrieved business object but not in the source array, the adapter recursively deletes it from the database unless the application-specific information for the attribute that represents the child in the parent has the KeepRelationship property set to true. In this case, the adapter does not delete the child from the database.


NULL data and the Update operation

The adapter can update a record from a database table when the column value is NULL.

For example, a Customer business object might have these columns: custid, ccode, fname, and lname, where custid and ccode form composite keys. Composite keys are primary keys that refer to more than one attribute and are used to define the uniqueness of the business object. You can update a Customer record for which ccode is NULL. The adapter would generate an update query for the Update operation as:

update customer set fname=?, lname=? where custid=? and ccode is null

The adapter treats an empty complex column as a null column irrespective of setting the value to null or unset.

For more information about null data, see Null Data - Frequently Asked Questions.

Outbound operations


Related concepts:

Create operation

Retrieve operation

RetrieveAll operation

UpdateAll operation

ApplyChanges operation

Delete operation

DeleteAll operation

Execute operation

Exists operation

Upsert operation

Batch operations


Related tasks:

Selecting and configuring tables, views, and synonyms or nicknames for outbound processing

Selecting and configuring query business objects


Related reference:

Fault business objects

Business object attributes