Too Long; Didn't Read
Locking is a mechanism that allows parallel work with the same data in the database. When more than one transaction tries to access the same data simultaneously, locks come into play, which ensures that only one of these transactions will change the data. JPA supports two types of locking mechanisms: optimistic model and pessimistic model. We will try different kinds of locking on a Spring Data JPA application with concurrent transactional code.