【发布时间】:2014-09-28 10:57:12
【问题描述】:
有我的普通 sql 查询:
SELECT id, title,
IF(o.fixed_on_top = 1 AND o.fixing_on_top_day_counter > 5, 1 ,0) actual_fixed_on_top
FROM orders o
ORDER BY actual_fixed_on_top DESC, publication_date DESC;
如何在 JpaRepository 上执行这样的排序? 也许使用标准 API? 但我找不到任何例子.. 谢谢!
编辑: ok,研究了不同的方式,确信不能通过Criteria API来实现(但很可惜)
一个可行的变体:本地 SQL 查询,我确定。
【问题讨论】:
标签: sql hibernate sorting jpa spring-data-jpa