spring - Group toghether Node properties and return as a view in Cypher -
i working v2.2.3 of neo4j , spring neo4j data sdn 4 want return few properties of node using cypher query , map them attributes of pojo.my function in spring data repository looks
@query( "match(n:serviceprovider{profilestatus:{pstatus},currentresidencestate:{location}}) return n.name,n.currentresidenceaddress ,n.employmentstatus," + "n.idprooftype,n.idproofnumber order n.registrationdate desc skip{skip} limit {limit}") list<adminsearchmapresult> getserviceproviderrecords( @param("pstatus")string pstatus, @param("location")string location, @param("skip") int skip,@param("limit")int limit);
i error like
scalar response queries must return 1 column. make sure cypher query returns 1 item.
i think because of fact cant bundle returned attributes view can map pojo
if return node , map pojo works
kindly guide
this can done using @queryresult
annotate adminsearchmapresult
pojo @queryresult
. example:
@queryresult public class adminsearchmapresult { string name; string currentresidenceaddress; ... }
optionally annotate properties @property(name = "n.idprooftype")
if alias different field name.
Comments
Post a Comment