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
UpdateAll operation
The UpdateAll operation updates multiple database records at a time, and returns the record count to indicate how many records have been updated.
The UpdateAll operation uses the UpdateAllInput business object as the input parameter. The UpdateAllInput business object has two child business object attributes querysample and valuesample. These attributes belong to the table business object type. The adapter uses the querysample attribute to filter the records that must be updated and the valuesample attribute to update all the matching records.
The following screen illustrates the structure of the UpdateAllInput business object. The name of the business object contains the schema name followed by the database table name and then the business object name, <schemaName><tableName>UpdateAllInput.
The output of the UpdateAll operation is UpdateAllResult business object, which contains the recordcount attribute. The following screen illustrates the structure of the UpdateAllResult business object returned from an UpdateAll operation.
To process the UpdateAll operation, the adapter performs the following actions:
- The adapter uses the attributes in the UpdateAllInput business object to generate a single update SQL statement. The query rule (WHERE clause) of the update SQL statement is generated based on the querysample attribute, and the update rule (SET clause) is generated based on the valuesample attribute.
If all the attributes of valuesample are unset, the adapter returns the MissingData fault.
- The adapter executes the SQL statement to update all the matching records.
If the business object is hierarchical, only the top-level business object (the individual business object at the top of a hierarchical business object) is updated. If you attempt to change the relationship of the hierarchical business objects through the UpdateAll operation, and if the operation violates the data integrity constrains in the database, the adapter returns the IntegrityConstraintViolation fault.
If the primary key attribute in valuesample is set, the adapter updates the corresponding column; however, if multiple records are matched and the primary key constrain is defined in database, the adapter generates the UniqueConstraint fault.
- The adapter obtains the execution result of the update SQL statement, and sets the recordcount attribute on the UpdateAllResult business object.
For example, if the adapter determined that there are 10 records that have been updated, it sets the recordcount parameter to recordcount=10.
If there are no records matching the query rule, then no records are updated, and the recordcount output parameter is 0.
If you want the adapter to return RecordsNotFoundException when records no records are affected during the UpdateAll or DeleteAll operation, you must select the Return exception when no records are affected during UpdateAll or DeleteAll operation check box in the Specify Composite Properties window of the external service wizard.
You can use the SQL capabilities to full extent for querying records by using child business object attributes or user-defined query criteria for operations.
Related concepts:
User-defined query criteria for operations
Matching records using child business object attributes
Related tasks:
Setting global properties for operations and creating wrapper business objects
Related reference: