Stéphane GRILLON
Stéphane GRILLON

Reputation: 11882

Spring Data LDAP using Pageable is it possible?

I use spring Data LDAP, I want return all user but by page. findAll work but return all user.

I try user Page<UserLdap> findAll(Pageable pageable); but I have tise error:

Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'userLdapRepository':
Invocation of init method failed;
nested exception is org.springframework.data.mapping.PropertyReferenceException:
No property findAll found for type UserLdap!

full code:

public interface UserLdapRepository extends LdapRepository<UserLdap> {
    Set<UserLdap> findAll();
    Page<UserLdap> findAll(Pageable pageable);
}

I try add extends PagingAndSortingRepository<UserLdap, Name> but I have the same error.

full code:

public interface UserLdapRepository extends PagingAndSortingRepository<UserLdap, Name>, LdapRepository<UserLdap> {
    Set<UserLdap> findAll();
    Page<UserLdap> findAll(Pageable pageable);
}

Is it possible using Pageable with Spring Data LDAP please?

EDIT:

I find this code in Spring Data ldap:

public Page<T> findAll(Predicate predicate, Pageable pageable) { ...

What is it a predicate please? If you have a sample, I'm happy :)

Upvotes: 1

Views: 2380

Answers (2)

Davi Carrano
Davi Carrano

Reputation: 509

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

See more in https://docs.spring.io/spring-data/ldap/docs/current/reference/html/#ldap.repositories

Upvotes: 1

St&#233;phane GRILLON
St&#233;phane GRILLON

Reputation: 11882

it is not possible:

UnsupportedOperationException()

@Override
public Page<T> findAll(Predicate predicate, Pageable pageable) {
    throw new UnsupportedOperationException();
}

Upvotes: 1

Related Questions