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
Copy file name to clipboardExpand all lines: hibernate-core/src/test/java/org/hibernate/orm/test/collection/delayedOperation/BagDelayedOperationTest.java
+1-2Lines changed: 1 addition & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -105,8 +105,7 @@ public void testSimpleAddDetached(SessionFactoryScope scope) {
Copy file name to clipboardExpand all lines: migration-guide.adoc
+55-50Lines changed: 55 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -153,56 +153,6 @@ String isDefault();
153
153
* Removed `org.hibernate.annotations.CascadeType.DELETE` in favor of `org.hibernate.annotations.CascadeType#REMOVE`
154
154
* Removed the attribute value from `@DynamicInsert` and `@DynamicUpdate`
155
155
156
-
[WARNING]
157
-
===
158
-
The removal of `CascadeType.SAVE_UPDATE` slightly changes the persist and flush behaviour (not affecting application using `Entitymanager`) that now conforms with the Jakarta JPA specifications.
159
-
160
-
Persisting a transient entity with an associated detached entity where the association is annotated with cascade=all or cascade=persist throws an exception if the detached entity has not been re-associated with the the session using lock or merge.
161
-
162
-
The same happens when flushing a managed entity having an associated detached entity.
will throw an `jakarta.persistence.EntityExistsException`
202
-
203
-
in order to fix the issue we can call `session.lock(c1,LockMode.NONE)` before adding `c1` to the `parent` or instead using `p.addChild( session.merge(c1) )`;
204
-
205
-
206
156
[[ddl-implicit-datatype-timestamp]]
207
157
== Default precision for timestamp on some databases
208
158
@@ -244,6 +194,61 @@ one file at a time. This is now done across the entire set of `hbm.xml` files a
244
194
While most users will never see this change, it might impact integrations which tie-in to
245
195
XML processing.
246
196
197
+
[[flush-persist]]
198
+
== Session flush and persist
199
+
200
+
The removal of `CascadeType.SAVE_UPDATE` slightly changes the persist and flush behaviour (not affecting application using `Entitymanager`) that now conforms with the Jakarta JPA specifications.
201
+
202
+
Persisting a transient entity or flushing a manged entity with an associated detached entity having the association annotated with `cascade = CascadeType.ALL` or `cascade = CascadeType.PERSIST` throws now an `jakarta.persistence.EntityExistsException` if the detached entity has not been re-associated with the the Session.
203
+
204
+
To re-associate the detached entity with the Session the `Session#merge` method can be used.
0 commit comments