Verify and fix ID class generation for inner classes

Description

In order to avoid ambiguity, components of generated ID class (see Jira issue https://hibernate.atlassian.net/browse/HHH-18829) must be alphabetically sorted by corresponding property name.

Additionally, ID class auto generation has been implemented before meta data classes generation from inner classes (Jira issue https://hibernate.atlassian.net/browse/HHH-18693) , but ID class auto generation of inner lasses has not been properly tested.

Activity

Show:

Čedomir Igaly February 28, 2025 at 11:15 AM

Created Jira issue https://hibernate.atlassian.net/browse/HHH-19214 and pull request #9824 that are showing bug with unsorted record components.

Čedomir Igaly February 28, 2025 at 10:46 AM
Edited

Reverted those changes. Now, when record components are not alphabetically sorted, three tests are failing:

org.hibernate.orm.test.annotations.formula.JoinFormulaManyToOneLazyFetchingTest,

org.hibernate.orm.test.annotations.formula.JoinFormulaManyToOneNotIgnoreLazyFetchingTest, and

org.hibernate.orm.test.annotations.formula.JoinFormulaOneToOneNotIgnoreLazyFetchingTest.

This is not caused by ID class generation.

 

PR #9819

Čedomir Igaly February 28, 2025 at 10:21 AM

OK, then I will removed that sorting part, leave only test cases verifying that ID class has been properly generated for inner class. And then create Jira issue with those tests that are failing with to unsorted record components (but passing with sorted).

Christian Beikov February 28, 2025 at 10:08 AM

I also fail to see the “why” here. It shouldn’t and AFAIU also isn’t necessary. Since we know the declaration order at compile time, I would just keep it that way instead of sorting by name for no good reason.

Čedomir Igaly February 28, 2025 at 9:40 AM

Not real bug, it is working as somebody wanted it to work. If I remember correctly, records were quite new think at the time when JPA 3.2 has been created. Maybe even in some preview phase.

Details

Assignee

Reporter

Priority

Created February 27, 2025 at 3:43 PM
Updated February 28, 2025 at 11:15 AM