pagination: Spring Data JPA Page vs Slice vs keyset Window scrolling, with the SQL and REST shapes

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b4bLvQVbZweAqqf54x
This commit is contained in:
Claude
2026-11-16 11:13:56 +05:30
parent e3d1b550ae
commit 91938727f2
42 changed files with 1446 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
GET /products/raw?size=1&sort=price,desc -> 200
{"content":[{"id":3,"name":"book-3","price":13.00}],"empty":false,"first":true,"last":false,"number":0,"numberOfElements":1,"pageable":{"offset":0,"pageNumber":0,"pageSize":1,"paged":true,"sort":{"empty":false,"sorted":true,"unsorted":false},"unpaged":false},"size":1,"sort":{"empty":false,"sorted":true,"unsorted":false},"totalElements":25,"totalPages":25}
GET /products/raw?size=1&sort=nope -> 400
{"detail":"No property 'nope' found for type 'Product'; Did you mean 'name'","instance":"/products/raw","status":400,"title":"Bad Request"}
GET /products/raw?size=1&sort=price;drop -> 400
{"detail":"Sort expression 'price;drop: ASC' must only contain property references or aliases used in the select clause; If you really want to use something other than that for sorting, please use JpaSort.unsafe(…)","instance":"/products/raw","status":400,"title":"Bad Request"}
GET /products/raw?size=1&sort=,desc -> 200
{"content":[{"id":1,"name":"book-1","price":11.00}],"empty":false,"first":true,"last":false,"number":0,"numberOfElements":1,"pageable":{"offset":0,"pageNumber":0,"pageSize":1,"paged":true,"sort":{"empty":true,"sorted":false,"unsorted":true},"unpaged":false},"size":1,"sort":{"empty":true,"sorted":false,"unsorted":true},"totalElements":25,"totalPages":25}