Spring LDAP JPA - 限制结果数
Spring LDAP JPA - Limit number of result
我正在使用 spring-ldap 2.0.4 和 spring-data-jpa 1.9.0.
我构建了一个这样的 JPA 存储库:
public interface PersonRepo extends LdapRepository<Person> {
Person findByUid (String uid);
@Query("(&(attribute=*{0}*)(attribute2=X)(attribute3=Y))")
List<Person> findByAttributeContains(String attribute);
}
到目前为止一切都很好。由于查询方法,我可以编写满足我需求的方法。
对于某些查询,我不得不使用 @Query 注释,因为它们有很多 and operator.
但我想将我的第二种查询方法的结果数限制为return。
我知道 Top 和 First 关键字可以在 spring JPA 中定义查询方法。但我没能成功。另外我想在方法中使用多个 and 运算符。
谢谢
我设法使用 XML LDAP 配置限制了结果的数量。
<ldap:ldap-template context-source-ref="contextSource" count-limit="100"/>
我正在使用 spring-ldap 2.0.4 和 spring-data-jpa 1.9.0. 我构建了一个这样的 JPA 存储库:
public interface PersonRepo extends LdapRepository<Person> {
Person findByUid (String uid);
@Query("(&(attribute=*{0}*)(attribute2=X)(attribute3=Y))")
List<Person> findByAttributeContains(String attribute);
}
到目前为止一切都很好。由于查询方法,我可以编写满足我需求的方法。 对于某些查询,我不得不使用 @Query 注释,因为它们有很多 and operator.
但我想将我的第二种查询方法的结果数限制为return。
我知道 Top 和 First 关键字可以在 spring JPA 中定义查询方法。但我没能成功。另外我想在方法中使用多个 and 运算符。
谢谢
我设法使用 XML LDAP 配置限制了结果的数量。
<ldap:ldap-template context-source-ref="contextSource" count-limit="100"/>