Skip to content

Commit ba77bd2

Browse files
committed
HHH-18830 migration guide update
Signed-off-by: Gavin King <[email protected]>
1 parent d5e829d commit ba77bd2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

migration-guide.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,16 @@ Previously, `char` and `Character` fields were, by default, mapped to `char(1)`
410410
However, MySQL treats a `char(1)` containing a single space as an empty string, resulting in broken behavior for some HQL and SQL functions.
411411
Now, `varchar(1)` is used by default.
412412

413+
[[unowned-order-column]]
414+
== `@OrderColumn` in unowned `@OneToMany` associations
415+
416+
In an unowned (`mappedBy`) one-to-many association, an `@OrderColumn` should, in principle, also be mapped by a field of the associated entity, and the value of the order column should be determined by the value of this field, not by the position in the list.
417+
418+
Previously, since version 4.1, https://hibernate.atlassian.net/issues/HHH-18830[Hibernate would issue superfluous SQL `UPDATE` statements] to set the value of the order column based on the state of the unowned collection.
419+
This was incorrect according to the JPA specification, and inconsistent with the natural semantics of Hibernate.
420+
421+
In Hibernate 7, these SQL `UPDATE` statements only occur if the `@OrderColumn` is _not_ also mapped by a field of the entity.
422+
413423
[[cleanup]]
414424
== Cleanup
415425

0 commit comments

Comments
 (0)