It should be possible to test it periodically against the production database, due to the different pessimistic locking specification & implementation between it and the in-memory database, used for testing.It should be possible to integrate the solution in most CI pipelines, based on an in-memory database.In this blog post, I will show you through the medium of 3 GitHub projects how you could test it within Spring Boot Application against Oracle, MySQL and PostgreSQL.īut before that, let's try to identify the user needs for a viable solution: User Needs For Testing Pessimistic Locking Handling Yet leaving a critical part of the code untested is against the software craftsmanship's principles. Testing pessimistic locking handling in JPA is tricky because of the lack of JPA support of LockTimeout by different RDBMS providers.