Default JDBC repository interface should contain `findIdForUpdate`
Feature description
Correct use of concurrency in an RDBMS often requires the use of SELECT ... FOR UPDATE but Micronaut makes doing the right thing less convenient than it should be. The default set of methods in CrudRepository should expose a method that locks the row.
Maybe we can create a new annotation that will force it
You mean changing the default for all find* methods? That would be a interesting feature. Maybe I'm just a power user but I kinda like to control locking individually, though. If you take locks when you don't mean to it's easy to accidentally deadlock.
IMHO locks are hard core in DBs, so I don’t like default method like that. So you would need to write a proper method name or annotate the ordinary find methods
Well any save or update method already takes locks, they can't be avoided. In many cases software just isn't correct if not using find...ForUpdate especially when working with entity objects instead of projections.