【发布时间】:2019-02-08 00:37:06
【问题描述】:
我正在尝试指定一个带有 @Query 注释的存储库方法和一个带有 Sort 对象的 Pageable:
编辑 1:此存储库正在扩展 PagingAndSortingRepository。
@Query("...")
Page<Entity> findBySomething(..., Pageable pageable);
pageable 对象是使用以下方法签名指定的:
public PageRequest(int page, int size, Direction direction, String... properties)
但是生成的输出查询没有排序选项,例如:
select a, b, c from table_x where ... limit 10
...虽然我期待的是:
select a, b, c from table_x where ... order by a asc limit 10
这里有人遇到过这种问题吗? 我正在使用 Spring-Boot 1.5.x。
【问题讨论】:
标签: hibernate spring-boot jpa spring-data-jpa spring-data