Enable Optimistic Locking This page last changed on Nov 28, 2008. .stickable, h1, h2, h3, h4, h5 false true Show Sticky notes Hide Sticky notes Save Cancel Oracle Data Service Integrator Documentation > Data Services Developer's Guide # How To Enable Optimistic Locking This topic describes how to enable optimistic locking in order to update a physical relational data source. Set the Locking Policy Select the Locking Fields See Also ## Set the Locking Policy Define the optimistic locking policy on the physical data sources that support your logical data service before you attempt to test an update in Test view or use an update map. Optimistic locking is used with physical data sources that are relational. The current value of optimistic locking is defined in the Optimistic Locking Fields property. You can see this property in the Properties tab in Overview mode. ##### Checking the Optimistic Locking Policy Updates to relational data sources use a special XML structure called a data graph. The root element of data graph is <sdo:datagraph>, and the data graph also has a <changeSummary> element. You can use any of these values for Optimistic Locking Fields. They describe how the elements in the data graph compare to fields in the relational data source.
Value of Optimistic Locking Fields | Effect
--- | ---
PROJECTED | All elements in the data graph are mapped to the data source to verify whether it can be updated. Default value.
UPDATED | Only elements that have changed in your data graph are used to verify whether the data source has changed.
SELECTED FIELDS | Selected elements are used to verify whether the data source has changed. The elements must be non-key elements.
To set the locking policy: Open a physical data service in Workshop for WebLogic. Click the Overview tab, then below it, the Properties tab. At Optimistic Locking Fields, click in the Value column, then choose a value. ## Select the Locking Fields If you choose SELECTED FIELDS, you must also select the fields used to verify changes in the data source. You can select any number of non-key fields. The key fields are used to identify the data records to be updated. If you select a complex element, its child elements also become selected elements. You can also disable a field once it is selected. ##### Choosing Fields for Optimistic Locking To select the fields used for optimistic locking: Click the Overview tab. Right-click a non-key element in the return type. Key elements are marked with . Choose Enable Optimistic Locking. When you enable optimistic locking for a field, its icon (in the return type in the Overview tab) changes to . You can also see the optimistic locking fields in the pragma statement at the top of the service's Source tab:
    (::pragma  xds <x:xds targetType="t:CREDITRATING" xmlns:x="urn:annotations.ld.oracle.com" xmlns:t="ld:physical/CREDITRATING"> ... <optimisticLockingFields>   <field name="RATING"/> </optimisticLockingFields>
## See Also ##### How To Test an Update Procedure ##### Concepts Brief Overview of Service Data Objects (for Workshop for WebLogic) Data Programming Model and Update Framework (in depth, for client applications)

Document generated by Confluence on Jan 13, 2009 15:57