HHH-18445 Always preserve correct property order for java records

This commit is contained in:
Marco Belladelli 2024-07-31 10:16:08 +02:00
parent f9a4efaa8f
commit 234bff41b8
1 changed files with 2 additions and 2 deletions

View File

@ -139,8 +139,8 @@ public class PropertyContainer {
List<MethodDetails> getters) {
final Map<String, MemberDetails> attributeMemberMap;
// If the record class has only record components which match up with fields and no additional getters,
// we can retain the property order, to match up with the record component order
if ( !recordComponents.isEmpty() && recordComponents.size() == fields.size() && getters.isEmpty() ) {
// we must retain the property order, to match up with the record component order
if ( !recordComponents.isEmpty() && recordComponents.size() == fields.size() ) {
attributeMemberMap = new LinkedHashMap<>();
}
//otherwise we sort them in alphabetical order, since this is at least deterministic