I'm trying to add my own (custom) findMembersByName method to my couchbase repository.
My code looks like this:
public interface MembersRepository extends PagingAndSortingRepository<Member, Long>, MembersRepositoryCustom {
@Query("#{#n1ql.selectEntity} WHERE (IFMISSING(firstname,'') || ' ' || IFMISSING(lastname,'')) LIKE $1 AND #{#n1ql.filter}")
Page<Member> findMembersByName(String name, Pageable pageable);
}
but if I try run this method I get exception:
org.springframework.data.repository.query.ParameterOutOfBoundsException: Invalid parameter index! You seem to have declare too little query method parameters!
All works fine if I remove pagination, so my query is fine. There is a problem with passing 'name' argument to statement.
How should I pass additional param to query when I use pagination?
Page/Slice queries don't make much sense with inlined N1QL queries.
That is because by definition each new page must use a slightly modified query (limiting and offsetting on the current page). This is not something we support with a plain String statement.
(note: However this particular message may still be from a bug in Spring Data Commons
)