Order by count using Spring Data JpaRepository

后端 未结 3 901
花落未央
花落未央 2020-12-05 15:51

I am using Spring Data JpaRepository and I find it extremely easy to use. I actually need all those features - paging, sorting, filtering. Unfortunately there is one little

3条回答
  •  我在风中等你
    2020-12-05 16:37

    I don't know much about Spring Data but for JPQL, to sort the objects by size of associated collection, you can use the query

    Select a from A a order by a.bes.size desc
    

提交回复
热议问题