Skip to content

Commit 234bff4

Browse files
committed
HHH-18445 Always preserve correct property order for java records
1 parent f9a4efa commit 234bff4

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
@@ -139,8 +139,8 @@ private static Map<String, MemberDetails> buildAttributeMemberMap(
139139
List<MethodDetails> getters) {
140140
final Map<String, MemberDetails> attributeMemberMap;
141141
// If the record class has only record components which match up with fields and no additional getters,
142-
// we can retain the property order, to match up with the record component order
143-
if ( !recordComponents.isEmpty() && recordComponents.size() == fields.size() && getters.isEmpty() ) {
142+
// we must retain the property order, to match up with the record component order
143+
if ( !recordComponents.isEmpty() && recordComponents.size() == fields.size() ) {
144144
attributeMemberMap = new LinkedHashMap<>();
145145
}
146146
//otherwise we sort them in alphabetical order, since this is at least deterministic

0 commit comments

Comments
 (0)