I am using Spring Boot and Oracle Database with Spring Data ORM, when I use bellow code
@Lock(LockModeType.PESSIMISTIC_WRITE)
@Query("SELECT c FROM Customer c WHERE c.orgId = ?1")
public List<Customer> fetchCustomersByOrgId(Long orgId);
I expect that another transaction can not select this record but when I run my Application the result is not in my expect, so first transaction1 select customer and wait for update and transaction2 can select customer before completing transation1 and this is my problem because I expect transaction2 wait for finishing transaction1 and after that can select customer. If you have a solution for this problem please let me know, Thanks