I have two tables `chapter` and `chapter_title_1`, there is a fk `chapter_id` in table `chapter_title_1` reference to table `chapter`.
Two entity class are `ChapterEntity.class` refer to table `chapter` and `ChapterTitle1Entity.class` refer to table `chapter_title_1`. There is a List<ChapterTitle1Entity> chapterTitle1EntityList in `ChapterEntity.class` annotated with `@OneToMany`. I want to get a list of `ChapterEntity` ordered by ChapterEntity.sequence asc and a list of `ChapterTitle1Entity` in each item of `ChapterEntity` ordered by `ChapterTitle1Entity.sequence` desc.
Originally, I use Criteria to query, but someone told me that order by may be not applies to child collection. so I change to use `@orderby annotation` but the embarrassing thing is sometimes I want to obder by `ChapterTitle1Entity.sequence` desc and sometimes I want to order by `ChapterTitle1Entity.sequence` asc.
Could anybody help me to achieve this. THANKS IN ADVANCE!
PS:
I am a newer to hibernate and don't want to improve any performance, I just want to solve this problem