Is it possible to have two methods in the spring-data repository - one without locking T findOne(Predicate p);
together with the same but with locking @Lock(LockModeType.PESSIMISTIC_WRITE) T findOne(Predicate p);
?
I wish there was something like
public interface TransactionRepository extends JpaRepository<Transaction, String>,
QueryDslPredicateExecutor<Transaction> {
@Lock(LockModeType.PESSIMISTIC_WRITE)
@AliasFor("findOne")
Transaction findOne_withLock(Predicate p);
}
No, its not possible
Java does not allow you to define two functions with the same prototype. U can instead have a selector which calls the functions based on some environment variable