SAP / olingo-jpa-processor-v4

The JPA Processor fills the gap between Olingo V4 and the database, by providing a mapping between JPA metadata and OData metadata, generating queries and supporting the entity manipulations.
Apache License 2.0
122 stars 76 forks source link

Is it even possible to do server side paging towards the database if ordering can not be guaranteed? #191

Closed PerArneng closed 1 year ago

PerArneng commented 1 year ago

The example paging provider in the source repository does an offset/limit query on each page. According to ex the PostgreSQL documentation it's not recommended to do that without an order by. https://www.postgresql.org/docs/current/queries-limit.html . Is it even possible to make reliable server-side paging when the order is not guaranteed?

PerArneng commented 1 year ago

One solution that seems to work is to have database views that contain order by to ensure that there is an order

wog48 commented 1 year ago

Actually, also server driven paging shall by default create an ORDER BY primary key, as it is done for client driven paging with $top and $skip. This is a bug.

wog48 commented 1 year ago

I have created a correction. See PR https://github.com/SAP/olingo-jpa-processor-v4/pull/194.

Please try it out. In case you still face a problem, reopen the issue