Skip to content

Commit 5b38761

Browse files
committed
Clarify intended nestedTransactionAllowed default in JpaTransactionManager
Closes gh-35212
1 parent 0e3e34b commit 5b38761

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

spring-orm/src/main/java/org/springframework/orm/hibernate5/HibernateTransactionManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@
8888
* such a scenario (see container setup).
8989
*
9090
* <p>This transaction manager supports nested transactions via JDBC Savepoints.
91-
* The {@link #setNestedTransactionAllowed} "nestedTransactionAllowed"} flag defaults
91+
* The {@link #setNestedTransactionAllowed "nestedTransactionAllowed"} flag defaults
9292
* to "false", though, as nested transactions will just apply to the JDBC Connection,
9393
* not to the Hibernate Session and its cached entity objects and related context.
9494
* You can manually set the flag to "true" if you want to use nested transactions
9595
* for JDBC access code which participates in Hibernate transactions (provided that
96-
* your JDBC driver supports Savepoints). <i>Note that Hibernate itself does not
96+
* your JDBC driver supports savepoints). <i>Note that Hibernate itself does not
9797
* support nested transactions! Hence, do not expect Hibernate access code to
9898
* semantically participate in a nested transaction.</i>
9999
*

spring-orm/src/main/java/org/springframework/orm/jpa/JpaTransactionManager.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,14 @@
9393
*
9494
* <p>This transaction manager supports nested transactions via JDBC Savepoints.
9595
* The {@link #setNestedTransactionAllowed "nestedTransactionAllowed"} flag defaults
96-
* to {@code false} though, since nested transactions will just apply to the JDBC
97-
* Connection, not to the JPA EntityManager and its cached entity objects and related
98-
* context. You can manually set the flag to {@code true} if you want to use nested
99-
* transactions for JDBC access code which participates in JPA transactions (provided
100-
* that your JDBC driver supports Savepoints). <i>Note that JPA itself does not support
101-
* nested transactions! Hence, do not expect JPA access code to semantically
102-
* participate in a nested transaction.</i>
96+
* to "true" but should rather be "false", as nested transactions will just apply to
97+
* the JDBC Connection, not to the JPA EntityManager and its cached entity objects
98+
* and related context. As of Spring Framework 7.0, the default will be "false" in
99+
* alignment with other transaction managers, requiring an explicit switch to "true"
100+
* if you want to use nested transactions for JDBC access code which participates
101+
* in JPA transactions (provided that your JDBC driver supports savepoints).
102+
* <i>Note that JPA itself does not support nested transactions! Hence, do not
103+
* expect JPA access code to semantically participate in a nested transaction.</i>
103104
*
104105
* @author Juergen Hoeller
105106
* @since 2.0

0 commit comments

Comments
 (0)