![](/img/trans.png)
[英]Is this FindBugs nullpointer dereference error valid for spring-data Specification class?
[英]spring-data Slice with specification without Count
我想知道是否有简单的方法(或至少计划添加该功能)如何在将规范传递给JpaSpecificationExecutor .findAll(Specification spec, Pageable pageable ) 时返回没有计数查询的Slice
所以我想做这样的事情:
Slice<MessageViewEntity> messageViewEntities =
messageViewRepository.findAll(
messageViewRepository.withSearchSpecifications(language, categoryId, messageKey, longText),
new PageRequest(page, size)
);
不会执行 count 查询的地方。
我发现这个问题已经有将近 2 年的历史了,但在当前版本 10.1.2 中,我没有看到如何执行此操作的方法/方式。
谢谢
这是可以做到的。 看这里: https : //gist.github.com/tcollins/0ebd1dfa78028ecdef0b
基本上你需要:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.