I would like to use the built in query creation from method names, for example:

public Person findByFirstName(String firstName);

But I want to mark specific queries "for update" meaning to use:

public Person findByFirstNameForUpdate(String firstName);

Is there a way to make it work? I know I can create a new repository "PersonRepositoryForUpdate" but can I use the same repository?

没有正确的解决方案

其他提示

You can add the @Query annotation above the method and use any query and any name for the method.

@Query("select ...")
public Person findGiveAnyName(String firstName);

The query can be written in JPQL or SQL.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top