Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ws Wiki" for change 
notification.

The following page has been changed by KevinWilliams:
http://wiki.apache.org/ws/WorkingWithOptimisticConcurrencyControl

------------------------------------------------------------------------------
     </Config>
  }}}
  
- This line in the config file ''<Column columnName="OCC" collision="true" 
managed="true"/>'' designates the column named "OCC" as the version column and 
also sets "managed" to true.  The "managed" attribuete has to do with how the 
version column is changed.  In order for OCC to work, somebody has to change 
the value of the version column each time the row is modified.  A new value in 
the version column is what tells the DAS that some agent has modified the row.  
If a version column is "managed" then the DAS is responsible for incrementing 
the value of the column each time some column in the row is changed.  The other 
option is "managed= false" and in this case, the DAS will assume some other 
agent is responsible for updating the version column.  This other agent is 
likely to be the client application itself or the database via a trigger or 
some other mechanism.
+ This line in the config file ''<Column columnName="OCC" collision="true" 
managed="true"/>'' designates the column named "OCC" as the version column and 
also sets "managed" to true.  The "managed" attribuete has to do with how the 
version column is changed.  In order for OCC to work, some agent must change 
the value of the version column each time the row is modified.  A new value in 
the version column is what tells the DAS that the row has been modified.  If a 
version column is "managed" then the DAS is responsible for incrementing the 
value of the column each time some column in the row is changed.  The other 
option is "managed= false" and in this case, the DAS will assume some other 
agent is responsible for updating the version column.  This other agent is 
likely to be the client application itself or the database via a trigger or 
some other mechanism.
  
+ When applying changes made to a graph (see ChangeSummaryProcessing), the DAS 
will throw an exception if any table row has been modified since the row was 
read.  For example, if a DAS client reads a row representing a specific 
Customer and then tries to update that Customer, the DAS will throw an 
exception if the Custosmer has already been modified by some other agent.  The 
following example illstrates applying changes and checking for a collision 
failure:
+ 
+ {{{
+    DAS das = DAS.FACTORY.createDAS(getConfig("ManagedBooksConfig.xml"), 
getConnection());
+    // Read a book instance
+    Command select = das.getCommand("select book 1");
+    DataObject root = select.executeQuery();
+    DataObject book = root.getDataObject("BOOK[1]");
+    book.setInt("QUANTITY", 2);
+ 
+    // Try to apply changes and catch potential update collision occurred
+    try {
+       das.applyChanges(root);
+    } catch (RuntimeException ex) {
+       if (!ex.getMessage().equals("An update collision occurred")) {
+           recover();
+       }
+    }
+ }}}
+ 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to