>Did anyone know how it work ?
>
>Thank you and good day
CA doesn't handle pessimistic lock. However on any backend you can implement your custom pessimistic locking strategy. Using stored procedures you could create LockRecord(),ReleaseLock() procedures.
-A session starts and creates a GUID to identify the session uniquely. Say oApp.InstanceID.
-Calls lockrecord(oApp.InstanceID, tableName, PK(s)ToLock)
A table with a structure like:
cTableName, PK, cLockedBy, tLockedOn, noMax (to force unlimited lock)
holds locking information database wide. LockRecord() can 'lock' a record if:
Not in locked list or Locking duration is over an allowed maximum or the lock requester is the same as cLockedBy.
Returns back the passed instanceID as an indicator of success or recorded instanceID as an indicator of failure + 'who locked info'. So it looks like:
lcLockedBy = lockrecord(oApp.InstanceID, tableName, PK(s)ToLock)
if ( oApp.InstanceID == m.lcLockedBy ) && Success
-ReleaseLock() complements it to unlock acquired lock(s) unconditionally
-A third component is wise to have as a 'watchdog' to signal the lockers and if they're dead unlock.
While it's doable this way it's rare an app really needs pessimistic locking and not worth the complexity of coding.
Cetin