Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 2 KB

File metadata and controls

39 lines (30 loc) · 2 KB

This is a working example for PostgreSQL database accompanying the blog post "Testing Pessimistic Locking Handling with Spring Boot and JPA"

More examples here:

Intro

This SpringBoot maven project is part of my blog post where you could find not only explanation for it, but also theoretical background for:

  • What does pessimistic locking handling mean
  • How you could implement it within a Spring Boot Application and JPA on the Oralce, MySQL and PostgreSQL databases
  • How you could write integration tests for handling pessimistic locking.

Prerequisites:

  • Docker
  • JDK8+.

Setup

  • Start PostgreSQL database container from docker/db-up.sh
  • Check with "docker ps" if the container is up&running.

Run pessimistic locking integration test withing in-memory database Apache Derby

🔔 Ideal for your DevOps pipeline

  • Switch profile in InventoryServicePessimisticLockingTest.java to "test" (the default one)
  • Run "./mvnw clean verify".

Run pessimistic locking integration test withing Oracle DB

🔔 Ideal for quick local test to try the real database when changing the pessimistic locking handling code

  • Switch profile in InventoryServicePessimisticLockingTest.java to "test-oracle"
  • Run "./mvnw clean verify".

Have fun and do not hesitate to contact me if you have any questions or suggestions!

About me

My name is Andrey Zahariev Stoev. I am working as Senior Software Architect in Switzerland. I love software craftsmanship and systems thinking. I am passionate about travel, languages and cultural diversity exploration.