How to use Spring Data CouchBase 'findAll(Iterable<ID>)' Method? -


i'm trying use spring-data-couchbase.

i want list findall(iterable) method. set view 'all' production view.

but, meet exception. how can use findall(iterable) method?

below sample code , exception.

document class:

@document public class user {     @id     private string id;     private string userseq; } 

repository class :

public interface userrepository extends couchbaserepository<user, string> { } 

service class:

//list<string> same result & exception. set<string> friendset = new hashset<string>(); friendset.add("user8"); friendset.add("user6");  userrepository.findall(friendset) 

exception:

caused by: java.util.concurrent.executionexception: operationexception: server: bad_request reason: invalid utf-8 json: {{error,{2,"lexical error: invalid char in json text.\n"}},                  "[user8, user6]"} @ com.couchbase.client.internal.httpfuture.waitforandcheckoperation(httpfuture.java:98) @ com.couchbase.client.internal.httpfuture.get(httpfuture.java:82) @ com.couchbase.client.internal.httpfuture.get(httpfuture.java:72) @ com.couchbase.client.couchbaseclient.query(couchbaseclient.java:778) ... 66 more caused by: operationexception: server: bad_request reason: invalid utf-8 json: {{error,{2,"lexical error: invalid char in json text.\n"}},                  "[user8, user6]"} @ com.couchbase.client.protocol.views.nodocsoperationimpl.parseerror(nodocsoperationimpl.java:110) @ com.couchbase.client.protocol.views.viewoperationimpl.handleresponse(viewoperationimpl.java:68) @ com.couchbase.client.http.httpresponsecallback.completed(httpresponsecallback.java:103) @ com.couchbase.client.http.httpresponsecallback.completed(httpresponsecallback.java:51) @ org.apache.http.concurrent.basicfuture.completed(basicfuture.java:115) @ org.apache.http.nio.protocol.httpasyncrequester$requestexecutioncallback.completed(httpasyncrequester.java:376) @ org.apache.http.concurrent.basicfuture.completed(basicfuture.java:115) @ org.apache.http.nio.protocol.basicasyncclientexchangehandler.responsecompleted(basicasyncclientexchangehandler.java:179) @ org.apache.http.nio.protocol.httpasyncrequestexecutor.processresponse(httpasyncrequestexecutor.java:349) @ org.apache.http.nio.protocol.httpasyncrequestexecutor.inputready(httpasyncrequestexecutor.java:236) @ org.apache.http.impl.nio.defaultnhttpclientconnection.consumeinput(defaultnhttpclientconnection.java:267) @ org.apache.http.impl.nio.defaulthttpclientiodispatch.oninputready(defaulthttpclientiodispatch.java:165) @ org.apache.http.impl.nio.defaulthttpclientiodispatch.oninputready(defaulthttpclientiodispatch.java:51) @ org.apache.http.impl.nio.reactor.abstractiodispatch.inputready(abstractiodispatch.java:113) @ org.apache.http.impl.nio.reactor.baseioreactor.readable(baseioreactor.java:159) @ org.apache.http.impl.nio.reactor.abstractioreactor.processevent(abstractioreactor.java:338) @ org.apache.http.impl.nio.reactor.abstractioreactor.processevents(abstractioreactor.java:316) @ org.apache.http.impl.nio.reactor.abstractioreactor.execute(abstractioreactor.java:277) @ org.apache.http.impl.nio.reactor.baseioreactor.execute(baseioreactor.java:105) @ org.apache.http.impl.nio.reactor.abstractmultiworkerioreactor$worker.run(abstractmultiworkerioreactor.java:584) ... 1 more 

you have quote id:s before call findall(...).

    set<string> friendset = new hashset<string>();     friendset.add("\"user8\"");     friendset.add("\"user6\""); 

if id:s aren't quoted keys parameter sent couchbase server [user8, user6] isn't valid json, hence exception. pretty surprising behaviour...


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -