jpql order by subquery produces unexpected AST node exception

后端 未结 1 721
醉梦人生
醉梦人生 2021-01-21 08:09

I translated a working (postgre)sql query to jpql, but hibernate throws a

org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node exception

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-21 08:51

    JPQL doesn't support subqueries in order by. If I correctly understand your query, you can try something like this:

    select p 
    from Piece p left join p.user.receivedVotes rv
    group by p
    order by count(rv) desc, p.index
    

    0 讨论(0)
提交回复
热议问题