Are you saying this works? That would be really surprising to me.
What you see in the logs is the result of the toString
of the Pageable
you are providing.
Assuming I misunderstood you and this actually doesn't work:
Just remove the order by ?#{#pageable}
from your query.
Parameter binding doesn't work in that position and pagination is done behind the scenes by Spring Data JPA.
There was a bug concerning this which is fixed for quite some time now and there existed workarounds for it which looked similar to what you have, but they are no longer valid.
See https://jira.spring.io/browse/DATAJPA-928 for details.
Also, Spring Data and Native Query with pagination which basically is about the same issue.