There is such an example.
Do I understand correctly, without MANDATORY this function will mislead the developer?
In the sense that without a transaction, despite the name, the locking will not be performed.
interface EmployeRepository extends JpaRepository<Employe, String> {
@Transactional(propagation = Propagation.MANDATORY)
@Lock(LockModeType.PESSIMISTIC_WRITE)
Optional<Employe> findWriteLockedById(String id);
}