This page last changed on Jan 09, 2008 by tkatz.
eDocs Home > BEA AquaLogic Data Services Platform 3.0 Documentation > Data Services Developer's Guide
How To Add Update Map Procedures
This topic describes how to add a create, update, or delete procedure to a logical entity service.
Overview
In a logical entity service, you can add create, update, and delete procedures (called update map procedures) that act on underlying data sources. A procedure is an operation that can have side effects, for example, a create procedure that adds a new record to a database table and returns a key value.
You can create update map procedures visually in AquaLogic Data Services Studio and have the framework generate XQuery pragma statements and source code, or you can write the source code directly in XQuery or XQSE.
The XQuery pragma statement looks something like this:
(::pragma function <f:function kind="create" visibility="public" isPrimary="true" xmlns:f="urn:annotations.ld.bea.com">
This statement defines a create procedure, with public visibility, that is primary. Even though the pragma statement uses the keyword function, the operation you define is a procedure, as you can see from the declaration:
declare procedure cus:createCustomerAndAddress($arg as element(cus:CustomerAndAddress)*) as element(cus:CustomerAndAddress_KEY)\* external;
This line declares the procedure with the name createCustomerAndAddress, defines one argument with the service's return type, and specifies a key as a return value.
Generate Default Procedures
When you generate default update map procedures, they have these parameters and return values:
Type |
Parameters |
Return Value |
Create |
The current key |
The service's return type |
Update |
The service's return type |
None |
Delete |
The service's return type |
None |
Before you create update map procedures, especially create procedures, add a key to your service. A primary create procedure must return a key, and an update or delete procedure can accept a key as an argument.
To generate a default update map procedure:
- Create a key for your service.
- In the Overview tab, right-click at the left, right, or top, and choose Add Update Map Procedures.

- Select Add to indicate which procedures to add.
- Add names in the Name fields.
- Mark Primary to indicate if each procedure should be primary.
- Click OK.

- In the Overview tab, right-click a procedure name and choose Edit Signature.

- Make any necessary changes to the procedure signature in the dialog box.
Design Custom Procedures
You can also create procedures with the arguments and return types you choose. This is useful for procedures in addition to the primary create, update, and delete procedures.
To design custom procedures:
- Click Overview.
- Right-click at the top, left, or right, and choose Add Operation.
- Choose a value for Visibility.
- At Kind, choose create, update, or delete.
- At Name, enter a procedure name.

- (Optional) At Return Type, click Edit. Choose a primitive or complex type, then click OK.
- At Parameters, click Add.
- Choose a primitive or complex type from an XML or XSD file, then click OK.
- At Kind, choose a value.
Choose element to use the exact XML element you selected as a parameter; changed-element, if values in the element must be updated; schema-element, if the element must be validated according to an XML schema.
- At Occurrence, choose a value.
- Click OK in both dialog boxes.
See Also
Concepts
How Tos
Contact BEA | Feedback | Privacy | (c) 2008 BEA Systems
|