Closed kukel closed 6 years ago
Non-trivial but certainly doable if we use PK.
I already downloaded the source of OptimusFaces to start experimenting. Also for the multi-tenant part
Added to OmniPersistence in https://github.com/omnifaces/omnipersistence/commit/cd0f318eb2c97c9113eb425920227310106e0678
Nice one! It seems to work, but only if you go from page 1 to 2, to 3, etc. If you go back a page (or jump to a random page) results are not what you would expect. In that case it still uses the values from the last entity on the previous page, even if that page is actually the next page.
I'm also wondering if the following line in BaseEntityService.buildRange()
needs brackets around the left side of the &&
:
if (hasJoins || page.getOffset() > 0 && page.getLastId() == null)
Otherwise you'll get both the setFirstResult
and value based paging together.
It should be possible to use value based paging in the PrimeFaces LazyDatamodel and it could (if I analyzed the code correctly) be done in a generic way as well just like OptimusFaces currently does for offset based paging. Would be cool to have this.
https://blog.novatec-gmbh.de/art-pagination-offset-vs-value-based-paging/
Maybe I'll try do create something over the weekend and send a pull request