Community
Participate
Working Groups
Providing no value to the @OrderBy annotation or <order-by> element in orm.xml results in no ordering. The JPA spec and javadocs for @OrderBy specify that providing no value defaults to primary key ordering: "If the ordering element is not specified for an entity association, ordering by the primary key of the associated entity is assumed." Reproducible in 2.1.2 and 2.2.0 RC1.
Shaun, any update on this bug with respect to the model causing you to see this behavior? Chatted quickly with Peter and he was unable to reproduce it on his end.
I'll get you an update tomorrow and a reproduction.
Created attachment 186740 [details] Eclipse project with reproduction I apologize that the reproduction domain classes are cluttered with JAXB annotations but they were generated by the JAXB schema compiler. This is also why all mappings are in orm.xml. I have tried specifying @OrderBy on the Shipment.parcel (a collection despite the name) in Java but got the same failure as when specified in orm.xml
BTW, I also tried to reproduce this starting from scratch and couldn't. That's why I attached the cluttered reproduction as it must have some non-obvious quality that's causing this issue to manifest.
Created attachment 187523 [details] Proposed changes Re-produced your error. Our tests never explicitly checked for XML processing defaults, so I added a new test. The issue was only with XML defaulting, everything seems ok though annotations but I added a test for both XML and annotation for completeness sake.
Changes have been submitted. rev 8881 Verified by: Chris Delahunt New test (testOrderBySetting) added to the advanced composite pk test suites (covering both XML and annotation support). All tests pass (full regression test suite, extended jpa test suite and core lrg)
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink