From bf356f561daccd254b0c64ff93c5ef7d10db1d23 Mon Sep 17 00:00:00 2001 From: Jens Schauder Date: Thu, 8 Sep 2022 15:31:17 +0200 Subject: [PATCH] Clarify documentation for `@Modifying`. Modifying queries are executed directly against the database. No events or callbacks get called. Therefore also fields with auditing annotations do not get updated if they don't get updated in the annotated query. Closes #970 --- .../src/main/asciidoc/reference/r2dbc-repositories.adoc | 4 ++++ src/main/asciidoc/jdbc.adoc | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/spring-data-r2dbc/src/main/asciidoc/reference/r2dbc-repositories.adoc b/spring-data-r2dbc/src/main/asciidoc/reference/r2dbc-repositories.adoc index 76c15dbd..fa810457 100644 --- a/spring-data-r2dbc/src/main/asciidoc/reference/r2dbc-repositories.adoc +++ b/spring-data-r2dbc/src/main/asciidoc/reference/r2dbc-repositories.adoc @@ -253,6 +253,10 @@ The result of a modifying query can be: The `@Modifying` annotation is only relevant in combination with the `@Query` annotation. Derived custom methods do not require this annotation. +Modifying queries are executed directly against the database. +No events or callbacks get called. +Therefore also fields with auditing annotations do not get updated if they don't get updated in the annotated query. + Alternatively, you can add custom modifying behavior by using the facilities described in <>. [[r2dbc.repositories.queries.spel]] diff --git a/src/main/asciidoc/jdbc.adoc b/src/main/asciidoc/jdbc.adoc index 4da44552..0e926992 100644 --- a/src/main/asciidoc/jdbc.adoc +++ b/src/main/asciidoc/jdbc.adoc @@ -700,6 +700,10 @@ You can specify the following return types: * `int` (updated record count) * `boolean`(whether a record was updated) +Modifying queries are executed directly against the database. +No events or callbacks get called. +Therefore also fields with auditing annotations do not get updated if they don't get updated in the annotated query. + include::{spring-data-commons-docs}/query-by-example.adoc[leveloffset=+1] include::query-by-example.adoc[leveloffset=+1]