【发布时间】:2021-01-14 14:06:05
【问题描述】:
我想将 Slice 与 Specification 和 Pagable 一起使用;不是列表或页面。 以下在 JpaRepository 中工作:
public interface PersonRepository extends JpaRepository<Person, UUID>,
JpaSpecificationExecutor<Person> {
Slice<Person> findAllBy(Pageable pageable);
}
但是如果我添加一个规范,至少提供了 1 个参数,它将失败:
Slice<Person> findAllBy(Specification<Person> specification, Pageable pageable);
java.lang.IllegalArgumentException: At least 1 parameter(s) provided but only 0 parameter(s) present in query.
【问题讨论】:
-
你的仓库是否实现了
JpaSpecificationExecutor? -
是的。我更新了问题。
-
很好,你能添加你得到的错误吗?
-
java.lang.IllegalArgumentException: 至少提供了 1 个参数,但查询中只存在 0 个参数。
标签: spring spring-boot spring-data-jpa