You need to sign in to do that
Don't have an account?
cbarry9
FOR UPDATE - locking
When performing a SOQL query from Apex using the FOR UPDATE option, is the locking mechanism optimistic or pessimistic? In other words, if another user attempts to write to the same record, while it is locked FOR UPDATE by another user, will they wait (optimistic), or will they be returned an error immediately (pessimistic).
thanks in advance,
Chris
Sheldon from support helped me find the following quote in the Force.com Developer Guide:
"You can specifically lock a set of records in a result set by adding the keywords for update
to a SOQL query. This approach protects the integrity of your data, but can also cause other
processes to wait until the locking transaction completes, so carefully consider the use of these
options."
Can you post a link to where you found that in the manual? It always seems that no one of the manual contains all the detailfs. For eample, the SOQL manual doesn't even mention FOR UPDATE in the syntax.
So the 2 posts about the locking mechanism seem to be contradictory. I posted a question on the Salesforce Stack Exchange site, and got a very helpful answer from superfell:
SOQL Record Locking (FOR UPDATE)