Concurrency Control Articles
3 articles about Concurrency Control. Explore Spring Boot implementation, design, and operations across related topics.
-
How to Implement Optimistic Locking in Spring Boot + MyBatis
Explains how to build optimistic locking in MyBatis equivalent to JPA's @Version. Covers WHERE clause design for UPDATE statements using a version column, conflict detection via zero affected rows, exception classes extending Spring's standard exceptions, and retry strategies aware of transaction boundaries, with code examples using both Mapper XML and annotations.
-
How to Implement Pessimistic Locking (@Lock) with Spring Boot + JPA - PESSIMISTIC_WRITE and Deadlock Prevention
Learn how to apply PESSIMISTIC_WRITE/READ using Spring Data's JPA @Lock, verify the issuance of SELECT ... FOR UPDATE, control timeouts with jakarta.persistence.lock.timeout, avoid deadlocks, and choose between pessimistic and optimistic locking—explained with real code.
-
How to Implement Optimistic Locking (@Version) with JPA in Spring Boot to Prevent Concurrent Update Conflicts
Learn how to prevent 'Lost Update' issues that occur in e-commerce inventory updates and reservation systems using the @Version annotation. Covers OptimisticLockException handling, retry strategies with Spring Retry, and writing concurrency tests with practical code examples.