Skip to content

Commit 4e90983

Browse files
committed
HHH-19209 Reverting commit "Sorting record components by name when generating ID class"
Reverting test assertions checking if record components are alphabetically ordered
1 parent 6338d11 commit 4e90983

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/hhh18829/AutoGeneratedIdClassTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void setUp(SessionFactoryScope sessionFactoryScope) {
5656
public void test(SessionFactoryScope sessionFactoryScope)
5757
throws ClassNotFoundException, InvocationTargetException, InstantiationException, IllegalAccessException {
5858
final var idClass = Class.forName( EmployeeWithoutIdClass.class.getName() + "_$Id" );
59-
final var id = idClass.getConstructors()[0].newInstance( 1, "John Doe" );
59+
final var id = idClass.getConstructors()[0].newInstance( "John Doe", 1 );
6060
final var employees = sessionFactoryScope.fromSession(
6161
sess -> sess.createQuery( "from EmployeeWithoutIdClass where id=:id", EmployeeWithoutIdClass.class )
6262
.setParameter( "id", id )
@@ -70,7 +70,7 @@ public void test(SessionFactoryScope sessionFactoryScope)
7070
public void innerEntityClassTest(SessionFactoryScope sessionFactoryScope)
7171
throws ClassNotFoundException, InvocationTargetException, InstantiationException, IllegalAccessException {
7272
final var idClass = Class.forName( AutoGeneratedIdClassTest .class.getName() + "_$Inner_$Id" );
73-
final var id = idClass.getConstructors()[0].newInstance( 13, "Dave Default" );
73+
final var id = idClass.getConstructors()[0].newInstance( "Dave Default", 13 );
7474
final Inner employee = sessionFactoryScope.fromSession(
7575
sess -> sess.find( Inner.class, id ) );
7676
assertEquals( "1600 Pennsylvania Avenue", employee.address );

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
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;
7069
import static java.util.stream.Collectors.toList;
7170
import static javax.lang.model.util.ElementFilter.fieldsIn;
7271
import static javax.lang.model.util.ElementFilter.methodsIn;
@@ -488,7 +487,6 @@ private void addIdClassIfNeeded(List<? extends Element> fields, List<? extends E
488487
if ( components.size() < 2 ) {
489488
return;
490489
}
491-
components.sort( comparing( MetaAttribute::getPropertyName ) );
492490
putMember( ID_CLASS_MEMBER_NAME, new IdClassMetaAttribute( this, components ) );
493491
}
494492

tooling/metamodel-generator/src/test/java/org/hibernate/processor/test/hhh18829/AutoGeneratedIdClassTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void test() {
2929
System.out.println( TestUtil.getMetaModelSourceAsString( Address.class ) );
3030
System.out.println( TestUtil.getMetaModelSourceAsString( EmployeeWithIdClass.class ) );
3131

32-
checkIfIdClassIsGenerated( Employee.class, new String[] {"empId", "empName"} );
32+
checkIfIdClassIsGenerated( Employee.class, new String[] {"empName", "empId"} );
3333
checkIfIdClassIsGenerated( AnotherEmployee.class, new String[] {"empId", "empName"} );
3434

3535
final var clazz = getMetamodelClassFor( EmployeeWithIdClass.class );
@@ -46,8 +46,8 @@ public void testInner() {
4646
System.out.println( TestUtil.getMetaModelSourceAsString( Outer.Inner.class ) );
4747
System.out.println( TestUtil.getMetaModelSourceAsString( Outer.Super.class ) );
4848

49-
checkIfIdClassIsGenerated( Outer.Inner.class, new String[] {"empId", "empName"} );
50-
checkIfIdClassIsGenerated( Outer.Super.class, new String[] {"empId", "empName"} );
49+
checkIfIdClassIsGenerated( Outer.Inner.class, new String[] {"empName", "empId"} );
50+
checkIfIdClassIsGenerated( Outer.Super.class, new String[] {"empName", "empId"} );
5151
}
5252

5353
private static void checkIfIdClassIsGenerated(Class<?> entityClass, String[] idComponentNames) {

0 commit comments

Comments
 (0)