Closed prafullazee closed 1 year ago
The pagination
in Cassandra pagination is a bit misleading because Cassandra is actually scrolling through results. The Cassandra paging uses a forward-only cursor and there is no possibility to address individual pages. Rather, you start fetching the first query results and from that first query you can then continue to the next page only.
That being said, that is the reason why you cannot construct a page request for pages other than index zero. If you want to paginate across e.g. multiple web requests, then please save the paging state and restore it upon the next request (e.g. using query parameters).
@mp911de can you please give me any reference for these implementations? I tried implementing it from some stackoverflow post, but got the same error as above, may be I am missing something and not able to catch it.
can you please give me any reference for these implementations
I think the code you're looking for should look somewhat along the following example:
Page<Object> foo = …;
CassandraPageRequest nextPageable = (CassandraPageRequest) foo.nextPageable();
ByteBuffer pagingState = nextPageable.getPagingState();
// serialize page size + page number, serialize pagingState
// restore both
CassandraPageRequest.of(Pageable.ofSize(20).withPage(5), pagingState);
thank you @mp911de I will try with it.
Java: 19
Springboot: 3.0
Dependency:
Repository
Service:
Controller:
I tried below changes
and created an workaround which is super inefficient
would like to know, the best way to implement it .
From this PR https://github.com/spring-projects/spring-data-cassandra/pull/128 allow slice queries using reactive repositories. it seems it is possible, there is definitely I am missing something.