I am working on a requirement for implementing pagination using Spring Data Couchbase[Spring Boot version 2.4.2].
Custom Repository interface extends PagingAndSortingRepository
@Repository
public interface DocumentEntityRepository extends PagingAndSortingRepository<DocumentEntity, String> {
@Query("#{#n1ql.selectEntity} where #{#n1ql.filter} " +
"AND attribute1 IS NOT NULL " +
"AND ANY id IN attribute2 SATISFIES id IN [ #{#values} ] END"
)
Page<DocumentEntity> findByValue(@Param("values") String valueToBeSearched, Pageable pageable);
}
Index has been created for attribute1 & attribute2.
attribute2 data type is Set<String>
.
Following exception is thrown:
at org.springframework.data.repository.query.ExtensionAwareQueryMethodEvaluationContextProvider.lambda$collectVariables$0(ExtensionAwareQueryMethodEvaluationContextProvider.java:116)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at java.base/java.util.ArrayList$Itr.forEachRemaining(ArrayList.java:1032)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
at org.springframework.data.repository.query.ExtensionAwareQueryMethodEvaluationContextProvider.collectVariables(ExtensionAwareQueryMethodEvaluationContextProvider.java:114)
at org.springframework.data.repository.query.ExtensionAwareQueryMethodEvaluationContextProvider.getEvaluationContext(ExtensionAwareQueryMethodEvaluationContextProvider.java:80)
at org.springframework.data.couchbase.repository.query.StringBasedN1qlQueryParser.getExpression(StringBasedN1qlQueryParser.java:413)
at org.springframework.data.couchbase.repository.query.StringBasedN1qlQueryParser.<init>(StringBasedN1qlQueryParser.java:126)
at org.springframework.data.couchbase.repository.query.StringN1qlQueryCreator.<init>(StringN1qlQueryCreator.java:87)
at org.springframework.data.couchbase.repository.query.N1qlRepositoryQueryExecutor.execute(N1qlRepositoryQueryExecutor.java:60)
at org.springframework.data.couchbase.repository.query.CouchbaseRepositoryQuery.execute(CouchbaseRepositoryQuery.java:42)
at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137)
at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121)
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:152)
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:131)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.data.couchbase.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133)
The above query works if I invoke the above method without pagination(adding Offset and Limit fields to the above query) i.e. List findByValue(@Param("values") String valueToBeSearched);
Is there anything missing in the configuration?
I have tried extending CouchbaseRepository<> (which extends PagingAndSortingRepository) but same error response.