In apex when we get UNABLE_TO_LOCK exception,most of the solutions are referring to use FOR UPDATE clause in the SOQL. 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?
UNABLE_TO_LOCK Exception, will it be solved if i use FOR UPDATE clause?
user3576180
- 18
- 4