{"id":27377968,"url":"https://github.com/jusexton/spring-cassandra-pagination-example","last_synced_at":"2025-04-13T13:09:01.202Z","repository":{"id":135725060,"uuid":"199566407","full_name":"jusexton/spring-cassandra-pagination-example","owner":"jusexton","description":"Cassandra pagination example with spring boot.","archived":false,"fork":false,"pushed_at":"2021-07-29T05:42:53.000Z","size":104,"stargazers_count":11,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T13:08:57.987Z","etag":null,"topics":["cassandra","example-project","java","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jusexton.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-07-30T03:19:03.000Z","updated_at":"2025-02-01T06:50:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"e44a19bf-a3b0-4c7b-96c3-def751c1ed5d","html_url":"https://github.com/jusexton/spring-cassandra-pagination-example","commit_stats":null,"previous_names":["jusexton/spring-cassandra-pagination-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jusexton%2Fspring-cassandra-pagination-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jusexton%2Fspring-cassandra-pagination-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jusexton%2Fspring-cassandra-pagination-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jusexton%2Fspring-cassandra-pagination-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jusexton","download_url":"https://codeload.github.com/jusexton/spring-cassandra-pagination-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248717242,"owners_count":21150389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cassandra","example-project","java","spring-boot"],"created_at":"2025-04-13T13:09:00.678Z","updated_at":"2025-04-13T13:09:01.194Z","avatar_url":"https://github.com/jusexton.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring Cassandra Pagination Example with Spring Boot\n\nSmall CRUD application demonstration how to paginate results using Apache Cassandra with Spring Boot.\n\n## How it Works\nSimply put, Cassandra uses paging state to determine where to start reading results from. If no paging state is given,\ncassandra will read the result set starting from the beginning.\n\nThe main key to this functionality in Spring Boot is creating the CassandraPageRequest.\nNote the PageRequest object simply limits the number of results and does not determine where the results will be read from.\n\n```java\nprivate CassandraPageRequest createCassandraPageRequest(final Integer limit, final String pagingState) {\n    final PageRequest pageRequest = PageRequest.of(0, limit);\n    final PagingState pageState = pagingState != null ? PagingState.fromString(pagingState) : null;\n    return CassandraPageRequest.of(pageRequest, pageState);\n}\n```\n\nNow simply use your CassandraPageRequest like it was any other page request.\n```java\npublic CassandraPage\u003cUser\u003e getPageOfUsers(final CassandraPageRequest cassandraPageRequest) {\n    final Slice\u003cUser\u003e userSlice = userRepository.findAll(cassandraPageRequest);\n    return new CassandraPage\u003c\u003e(userSlice);\n}\n```\n\nPaging state is acquired from page requests to cassandra. It can be extracted by using the following method.\n```java\nCassandraPageRequest pageRequest = (CassandraPageRequest) slice.nextPageable();\nthis.pagingState = Objects.requireNonNull(pageRequest.getPagingState()).toString();\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjusexton%2Fspring-cassandra-pagination-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjusexton%2Fspring-cassandra-pagination-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjusexton%2Fspring-cassandra-pagination-example/lists"}