Pageable default value in 5.3.x

Hello,

I am currently experiencing problems during the migration of hibernate 5.2 to 5.3, regarding pagination.

Indeed, I used a default value, in order to disable this one: @PageableDefault (page = 0, size = Integer.MAX_VALUE) and PageRequest.of (0, Integer.MAX_VALUE) java side when necessary.

But since switching to version 5.3.1, I have the following error on my queries: “max-results can not be negative; nested exception is java.lang.IllegalArgumentException: max-results can not be negative”, and an error 409 is adjourned.

Do you know how to get around the problem?

Send us a test case that replicate the issue:

http://in.relation.to/2018/06/04/best-way-write-hibernate-orm-issue-test-case/

Thanks

I think the problem is when using Spring slices instead of pages. To be able to tell whether there is a next slice spring will add one to the max results. If there is one result more than the size of the current slice it knows that there is a next slice. However, adding 1 to Integer.MAX_VALUE results in a negative number.