我正在使用spring boot和jpa存储库,我想使用hql查询从数据库中获取最后2条记录。我已经写了下面的查询,但它不工作。@Query("select news from(select news from NewsDTO news order by news.newsId desc limit 2) sub order bynews.newsId asc") 它正在抛出下面的异常 Caused by: org.hibernate.hql.int
硬编码Dao示例工作,结果按ASC或DESC排序。@Query("SELECT * FROM cameras WHERE suburb LIKE '%' || :suburb || '%' AND postcode LIKE '%' || :postcode|| '%' ORDER BY directionASC LIMIT :limit OFFSET :offset ")
fun ge