Pessimistic Locking in JPA
·
Kotlin & Java/Spring
Pessimistic Locking in JPA PESSIMISTIC_READ allows us to obtain a shared lock and prevent the data from being updated or deleted. PESSIMISTIC_WRITE allows us to obtain an exclusive lock and prevent the data from being read, updated or deleted. PESSIMISTIC_FORCE_INCREMENT works like PESSIMISTIC_WRITE, and it additionally increments a version attribute of a versioned entity. PESSIMISTIC_READ Whene..