Bug?: `@Lock` on query methods does not add locking to query
Before with JPA a repo method with @Lock would get the FOR UPDATE sql part added to the query.
But now with Spring R2DBC that's no longer the case.
@Lock(LockMode.PESSIMISTIC_WRITE)
suspend fun findForUpdateById(id: UUID): Cart?
@koenpunt, Interesting, I just ran the test case under org.springframework.data.r2dbc.repository.query.PartTreeR2dbcQueryUnitTests#createQueryWithPessimisticWriteLock() in PartTreeR2dbcQueryUnitTests.java.java which matches with your usecase and the code seems to be generating the final query with the FOR UPDATE clause.
Please provide a Minimimal Reproducable Example, preferable as a Github repository. Make sure to include the database, either as an in memory database or if that is not possible using Testcontainers.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
I figured it out; we're using spring-boot-starter-data-r2dbc, which still uses the previous version of spring-data-r2dbc, which doesn't contain the pessimistic locking introduced in this commit.