-
Notifications
You must be signed in to change notification settings - Fork 0
Built-in Pagination and Sorting support #13
Copy link
Copy link
Open
Description
Problem
The library lacks native support for Spring Data's pagination and sorting abstractions. Users must manually implement pagination using SKIP and LIMIT in Cypher queries, resulting in verbose and error-prone code.
Current Workaround
public interface PersonRepository extends NodeRepository<Person, String, Void, Person> {
@Query("MATCH (n:Person) RETURN n ORDER BY n.name SKIP $offset LIMIT $limit")
List<Person> findAllPaginated(@Param("offset") int offset, @Param("limit") int limit);
@Query("MATCH (n:Person) RETURN count(n)")
long countAll();
// Manual pagination logic in service layer
Page<Person> findAll(Pageable pageable) {
int offset = pageable.getPageNumber() * pageable.getPageSize();
List<Person> content = findAllPaginated(offset, pageable.getPageSize());
long total = countAll();
return new PageImpl<>(content, pageable, total);
}
}Expected Behavior (Spring Data Style)
public interface PersonRepository extends NodeRepository<Person, String, Void, Person> {
Page<Person> findAll(Pageable pageable);
Page<Person> findByAgeGreaterThan(int age, Pageable pageable);
Slice<Person> findByActiveTrue(Pageable pageable);
List<Person> findByCity(String city, Sort sort);
List<Person> findAll(Sort sort);
}Proposed Solution
Implement Spring Data's Pageable, Page, Slice, and Sort abstractions with automatic Cypher generation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels