rwinch / spring-ldap

Apache License 2.0
0 stars 0 forks source link

LDAP-319: add pagination support to LdapRepository #52

Open rwinch opened 9 years ago

rwinch commented 9 years ago

Original Reporter: szott Environment: Not Specified Version: 2.0.2 Migrated From: https://jira.spring.io//browse/LDAP-319

rwinch commented 9 years ago

rwinch said: The [reference states|http://docs.spring.io/spring-ldap/docs/2.0.2.RELEASE/reference/#repositories]

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

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

rwinch commented 9 years ago

marthursson 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

rwinch 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?