|Apache Tuscany > Home > DAS Overview > DAS Java > DAS Java Documentation Menu > DAS Java Developer Guide > RDB DAS Java > RDB DAS - User Guide > OptimisticConcurrencyControl||User List | Dev List | Issue Tracker|
The RDB DAS is intended for use in disconnected scenarios. When the DAS returns a graph of SDO DataObjects as the result of a query, there are no locks held on the underlying database and the data is no longer associated with any database connection or transaction. However, although locks are not held, the DAS does employ a mechanism called Optimistic Concurrency Control (OCC) to manage concurrency.
Basically, when OCC is being utilized, the DAS checks whether the state of the database has changed since the original data was read before applying any writes to the same location. For example, suppose that a DAS client reads a set of Customers, modifies one Customer and then attempts to write the change back to the database:
If OCC is enabled then as part of "applyChanges" processing the DAS will ensure that the table row representing "CUSTOMER" has not been changed since it was read. This is possible because a feature of the original SDO graph is to "remember" its original state along with any changes that have been made. The DAS has access to this original state and uses it to create an "overqualified" update statement. When the DAS executes this update statement against the database, it will fail if the underlying data has been modified (a collision has occurred) and, if so, an exception will be thrown and the transaction rolled back. If there is no collision then the update statement execution succeeds and the change is applied.