The documentation currently mentions @Modifying annotation as a requirement for repository methods which are not querying data (i.e. INSERT/UPDATE/DELETE)
By applying the annotation, according to the docs:
Doing so triggers the query annotated to the method as an updating query instead of a selecting one.
The examples in the reference also applies the @Query annotation along with @Modifying which is perfectly fine.
However, when a derived query is used for data manipulation, the @Modifying annotation is not needed (at least this was the case last time I tested it). There is nothing mentioned in the docs about this behavior which might lead to confusions
I guess the reason it reads as it currently reads is that we assume you either use annotations to define queries or don't. If you're using query derivation, the method signature is what defines what gets executed. I guess that could be more prominently mentioned
spring-projects-issues commentedDec 19, 2018
Arnold Galovics opened DATAJPA-1485 and commented
The documentation currently mentions
@Modifying
annotation as a requirement for repository methods which are not querying data (i.e. INSERT/UPDATE/DELETE)By applying the annotation, according to the docs:
The examples in the reference also applies the
@Query
annotation along with@Modifying
which is perfectly fine.However, when a derived query is used for data manipulation, the
@Modifying
annotation is not needed (at least this was the case last time I tested it). There is nothing mentioned in the docs about this behavior which might lead to confusionsBackported to: 2.1.4 (Lovelace SR4), 2.0.13 (Kay SR13), 1.11.18 (Ingalls SR18)
The text was updated successfully, but these errors were encountered: