Ordering a join fetched collection in JPA using JPQL/HQL

后端 未结 3 1891
被撕碎了的回忆
被撕碎了的回忆 2021-02-07 14:40

Given the below JPQL statement, how do I modify it so that the kittens in the resulting list are ordered by their age property?

SELECT c FROM Cat c          


        
3条回答
  •  广开言路
    2021-02-07 15:22

    Hej,

    I don't think this is possible when applied using queries. But as far as I remember, you can use this to add default ordering to your collection in the mapping:

    @OrderBy("myColumName asc")
    

提交回复
热议问题