bil*_*lak 5 java spring spring-data-jpa
我想知道是否有简单的方法(或至少计划添加该功能)如何在将规范传递给JpaSpecificationExecutor .findAll(Specification spec, Pageable pageable ) 时返回没有计数查询的Slice
所以我想做这样的事情:
Slice<MessageViewEntity> messageViewEntities =
messageViewRepository.findAll(
messageViewRepository.withSearchSpecifications(language, categoryId, messageKey, longText),
new PageRequest(page, size)
);
Run Code Online (Sandbox Code Playgroud)
不会执行 count 查询的地方。
我发现这个问题已经有将近 2 年的历史了,但在当前版本 10.1.2 中,我没有看到如何执行此操作的方法/方式。
谢谢
可以办到。看这里: https ://gist.github.com/tcollins/0ebd1dfa78028ecdef0b
基本上你需要:
| 归档时间: |
|
| 查看次数: |
1582 次 |
| 最近记录: |