rwinch / spring-ldap-migrate-issues

0 stars 0 forks source link

LDAP-319: add pagination support to LdapRepository #318

Open rwinch opened 9 years ago

rwinch commented 9 years ago

Migrated from LDAP-319

So far Spring LDAP does not support pagination in conjunction with LdapRepository (and its concrete subclasses). This makes it hard to use findAll in cases with more than 1000 result objects. Are there any plans to extend SimpleLdapRepository in order to support pagination?

rwinch commented 9 years ago

Rob Winch said:

The reference states

Due to specifics of the LDAP protocol, paging and sorting is not supported for Spring LDAP repositories.

but I'm not familiar with the history of this. Perhaps [~ marthursson] can elaborate

rwinch commented 9 years ago

Mattias Hellborg Arthursson said:

The problem with pagination in LDAP is that you need to re-use the exact same connection for each pagination request, or else the pagination control becomes invalid. This means that pagination like you're used to with "real" databases (as it is normally done in Spring repositories, using Pageable etc.) would very tricky to implement. We would need to figure out a way to make sure the same underlying LDAP connection would be re-used for each subsequent pagination request (which may or may not come). It would probably be possible to do, but my previous assessment has been that it would not be worth the effort.

As described in the [reference section on paged results | http://docs.spring.io/spring-ldap/docs/2.0.2.RELEASE/reference/#paged-search-results], the problem with re-using the same connection can be managed by wrapping all the pagination calls using SingleContextSource. While it would be perfectly possible to do provide additional methods in SimpleLdapRepository to do the operation outlined in the reference documentation this really wouldn't be paging: what we do here is more like buffering.

rwinch commented 9 years ago

Rob Winch said:

Thanks for the response marthursson! What if we were able to include information in the response that could be passed in as an argument (similar to what page we are requesting)? Would that work?