You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve docs on transactionality of methods declared on repository interfaces.
We're now more specific on what CRUD methods means in the context of transactional query methods. Also, we now mention default methods explicitly in the discussion of query methods.
Fixes#2868.
By default, CRUD methods on repository instances inherited from link:$$https://docs.spring.io/spring-data/data-jpa/docs/current/api/org/springframework/data/jpa/repository/support/SimpleJpaRepository.html$$[`SimpleJpaRepository`] are transactional.
871
+
By default, methods inherited from `CrudRepository` inherited the transactional configuration from from link:$$https://docs.spring.io/spring-data/data-jpa/docs/current/api/org/springframework/data/jpa/repository/support/SimpleJpaRepository.html$$[`SimpleJpaRepository`].
872
872
For read operations, the transaction configuration `readOnly` flag is set to `true`.
873
873
All others are configured with a plain `@Transactional` so that default transaction configuration applies.
874
874
Repository methods that are backed by transactional repository fragments inherit the transactional attributes from the actual fragment method.
@@ -930,7 +930,8 @@ Note that the call to `save` is not strictly necessary from a JPA point of view,
930
930
[[transactional-query-methods]]
931
931
=== Transactional query methods
932
932
933
-
To let your query methods be transactional, use `@Transactional` at the repository interface you define, as shown in the following example:
933
+
Declared query methods (including default methods) do not get any transaction configuration applied by default.
934
+
To run those methods transactionally, use `@Transactional` at the repository interface you define, as shown in the following example:
0 commit comments