In apex when we get UNABLE_TO_LOCK exception,most of the solutions are referring to use FOR UPDATE clause in the SOQL.
My questions are:
- My Doubt is what if Already some other record has lock before running the SOQL ,will the query return that record?
- And if UNABLE_TO_LOCK exception is coming for Parent record of the failed record, then if we use FOR UPDATE while fetching the child record will work?
- and what if that query is returning records where more than two records have same parent, how will FOR UPDATE will lock parent records at that time?
- My Doubt is what if Already some other record has lock before running the SOQL ,will the query return that record?
- And if UNABLE_TO_LOCK exception is coming for Parent record of the failed record, then if we use FOR UPDATE while fetching the child record will work?
- And what if that query is returning records where more than two records have same parent, how will FOR UPDATE will lock parent records at that time?