Question: what is the difference between pessimistic locking and optimistic locking?
Answer: Optimistic Locking is when you check if the record was updated by someone else before you commit the transaction. Pessimistic locking is when you take an exclusive lock so that no one else can start modifying the record.