Skip to content

Commit 26c1655

Browse files
committed
HHH-18445 Always preserve correct property order for java records
1 parent 8bbdab5 commit 26c1655

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hibernate-core/src/main/java/org/hibernate/boot/model/internal/PropertyContainer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ public PropertyContainer(XClass clazz, XClass entityAtStake, AccessType defaultC
9797

9898
final Map<String, XProperty> localAttributeMap;
9999
// If the record class has only record components which match up with fields and no additional getters,
100-
// we can retain the property order, to match up with the record component order
101-
if ( !recordComponents.isEmpty() && recordComponents.size() == fields.size() && getters.isEmpty() ) {
100+
// we must retain the property order, to match up with the record component order
101+
if ( !recordComponents.isEmpty() && recordComponents.size() == fields.size() ) {
102102
localAttributeMap = new LinkedHashMap<>();
103103
}
104104
//otherwise we sort them in alphabetical order, since this is at least deterministic

0 commit comments

Comments
 (0)