spring-ldap
spring-ldap copied to clipboard
LDAP-319: add pagination support to LdapRepository
Sascha Szott (Migrated from LDAP-319) said:
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?
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
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.
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?
I'm facing OperationNotSupportedException: [LDAP: error code 12 - 00000057: LdapErr: DSID-0C090B0B, comment: Error processing control, data 0, v3839 ]; remaining name I've tried implementing it with doWithSingleContext but no luck. Surprisingly, it is bit inconsistent , it runs sometimes and fails rest of the time with no change in code.
I have implemented this recently with pure JNDI and it worked for me with Active Directory and DirX. Does your directory server support this?
I'm using Spring ldap rather than pure JNDI. Let me check it your way