Skip to content

Commit 3700128

Browse files
committed
HHH-19209 Sorting record components by name when generating ID class
1 parent 62ad590 commit 3700128

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
import static java.beans.Introspector.decapitalize;
6767
import static java.lang.Boolean.FALSE;
6868
import static java.util.Collections.emptyList;
69+
import static java.util.Comparator.comparing;
6970
import static java.util.stream.Collectors.toList;
7071
import static javax.lang.model.util.ElementFilter.fieldsIn;
7172
import static javax.lang.model.util.ElementFilter.methodsIn;
@@ -487,6 +488,7 @@ private void addIdClassIfNeeded(List<? extends Element> fields, List<? extends E
487488
if ( components.size() < 2 ) {
488489
return;
489490
}
491+
components.sort( comparing( MetaAttribute::getPropertyName ) );
490492
putMember( ID_CLASS_MEMBER_NAME, new IdClassMetaAttribute( this, components ) );
491493
}
492494

0 commit comments

Comments
 (0)