I am using Spring-Data-Jpa and using @Lock annotation(PESSIMISTIC_WRITE) for taking database(Oracle) locks. I need help in understanding that whether the following scenario can lead to a database dead lock.
- Transaction 1(PROPAGATION_REQUIRES_NEW, ISOLATION_DEFAULT) one takes a database lock over say Teacher table(say lock is taken over row with id=1). It tries to insert a new record in the child table say Meeting. No update is done on the Teacher table
- While Transaction 1 is in progress. Transaction 2(PROPAGATION_REQUIRED, ISOLATION_DEFAULT) tries to update the Teacher table(row with id=1). It does not take a database lock.
- Since the lock is taken over row with id 1. Transaction 2 has to wait for transaction 1 to get over.
Can this condition lead to a database dead lock?