Рет қаралды 11,451
In this tutorial explained how can we use optimistic and pessimistic locking. Also explained how and when to use pessimistic and optimistic locks?
Locking is a mechanism that allows us to do parallel work with the same data in the database. When more than one transaction tries to access the same data at the same time, locks come into play, which ensures that only one of these transactions will change the data.
JPA supports two types of locking mechanisms:
1. Optimistic Locking
2. Pessimistic Locking.
Explained both locking mechanism with one example (Reservation System). Booking a ticket with multi thread environment.
Source Code available here: github.com/Jav...
#javatechsolutions #springboot #java #java17 #springboot3 #h2database
#optimisticlocks #pessimisticlocks
If you guys like this video please do subscribe now and press the bell icon to not miss any update from Java Tech Solutions
For Subscribe: / @javatechsolutions