java - 如何使用可分页的 Spring 数据 JPA 选择不同的值?
问题描述
我想通过分页在我的表中进行不同的选择,但它声称这个错误。有谁知道如何解决它?
org.postgresql.util.PSQLException:错误:对于 SELECT DISTINCT,ORDER BY 表达式必须出现在选择列表中
@Query(value = "SELECT DISTINCT budget.* FROM budget LEFT JOIN user_budget ON budget.id = user_budget.budget_id ORDER BY budget.created DESC, ?#{#pageable}",
countQuery = "SELECT DISTINCT count(*) FROM budget LEFT JOIN user_budget ON budget.id = user_budget.budget_id",
nativeQuery = true)
public Page<Budget> findAllByfilter(Pageable pageable);
解决方案
推荐阅读
- html - Flexbox 方形项目与项目数量无关
- javascript - javascript,有没有办法在 touchmove 事件上设置(较小的)阈值
- python-3.x - Python子图和图像大小
- android - 如何在 Android 布局文件中获得两个带有下拉菜单的选项?
- netbeans - NetBeans -- 不代表有效的 javafx Scene Builder 安装
- flutter - Flutter,TextFormField 的内容填充无法正常工作?
- c - C语言中两个数字的32位加法
- javascript - 根据其他单选按钮的值更改单选按钮
- c - 用 C 编写的代码的递归到迭代转换
- html - 响应式网格