I am using Springboot 2.1.4 with spring-boot-data-couchbase. I am trying to make a paginated query using like operator for one property.
These are the artifacts:
- Repository
@N1qlPrimaryIndexed
@ViewIndexed(designDoc = "LogicalResource", viewName = "all")
public interface LogicalResourceRepository extends CouchbasePagingAndSortingRepository<LogicalResource, String>
{
Page<LogicalResource> findByValueLike(String value, Pageable pageable);
}
- Service
@Service
public class LogicalResourceService extends BaseCrudService<LogicalResource>
{
@Autowired
LogicalResourceRepository logicalResourceRepository;
@Override
public EntityListSlice<LogicalResource> simpleSearch(Integer page, Integer size, String search)
{
Page<LogicalResource> pageData = this.logicalResourceRepository.findByValueLike("%"+search+"%", PageRequest.of(page, size));
long totalElements = pageData.getTotalElements();
List<LogicalResource> data = pageData.getContent();
return new EntityListSlice<LogicalResource>()
.setPage(page)
.setSize(size)
.setTotal(totalElements)
.setEntities(data);
}
}
The class EntityListSlice is just a pojo to handle the data.
When the mehthod is invoked, the follow exception is thrown:
Unable to execute query due to the following n1ql errors: ↵{"msg":"Panic: runtime error: invalid memory address or nil pointer dereference","code":5001}
¿Is there a better way to make this kind of queries? ¿How can I handle the exception?