我正在尝试使用spring-data-couchbase进行分页和排序,但org.springframework.data.couchbase.repository似乎只有CouchbaseRepository,它扩展了CrudRepository<T,ID>。
没有从PagingAndSortingRepository<T,ID>扩展的接口。
http://docs.spring.io/spring-data/couchbase/docs/1.0.x/api/org/springframework/data/couchbase/repository/CouchbaseRepository.html
我实现了一个非常规的解决方案来解决设置跳过和限制的问题。但希望获得总页数,这在此解决方案中是不可用的。看起来Page<T>确实有.getTotalPages()
发布于 2022-01-17 22:19:25
下面是让分页工作的步骤。
使用extends CouchbaseRepository<Object, Object>
Page<Object> findAllById(String id, Pageable page)将
4.3.1或更高版本的就这样
发布于 2015-06-23 23:45:35
Spring Data Couchbase目前不支持分页,您需要使用较低级别的API,这基本上是Couchbase的Java SDK的第一个版本。
发布于 2017-08-21 17:21:52
因为Spring- data -CouchBase2.0.x支持PagingAndSortingRepository来对数据进行分页和排序。
该接口定义:
public interface PagingAndSortingRepository<T, ID extends Serializable>
extends CrudRepository<T, ID> {
Iterable<T> findAll(Sort sort);
Page<T> findAll(Pageable pageable);
}分页项目示例:
public interface ProjectRepository extends PagingAndSortingRepository<Project, String> {
Page<Project> findByName(String name, Pageable pageable);
}https://stackoverflow.com/questions/30994744
复制相似问题