There are a lot of documentation about optimistic and pessimistic lock types in Spring jpa. For example, here we can see next explanation about optimistic and pessimistic locking
Optimistic locking is fully controlled by JPA and only requires additional version column in DB tables. It is completely independent of underlying DB engine used to store relational data.
On the other hand, pessimistic locking uses locking mechanism provided by underlying database to lock existing records in tables. JPA needs to know how to trigger these locks and some databases do not support them or only partially.
If there is no lock specified, the default one is LockModeType.NONE
what happens if we run multiple transaction in parallel? When do we need to use locking and where can we avoid it?