neo4j - can not do sorting and pagination on SpringDataNeo4j 4.2 M1 (Ingalls) -
i need pagination , sorting on custom queries in sdn 4. upgraded sdn latest available release : version 4.2 m1 (ingalls) , based on ticket issue fixed in version. when try sorting or pagination throws exception saying :
org.neo4j.ogm.exception.cypherexception: error executing cypher; code: n/a; description: unable convert org.springframework.data.domain.pagerequest neo4j value.
this code use :
pageable pageable = new pagerequest(0, 3, sort.direction.desc, "name"); owners = ownerrepository.getownersbyfacetgroupid(facetgroupid, pageable);
and repository query :
public interface ownerrepository extends neo4jrepository<owner> { @query("match (n:owner)-[r:has]-(c:facet_group) id(c)={0} return n") list<owner> getownersbyfacetgroupid(long id , pageable pageable);}
and final request neo4j uses:
request: match (n:owner)-[r:has]-(c:facet_group) id(c)={0} return n order n.name desc params {0=9275402, 1={sort=[{direction=desc, property=n.name, ignorecase=false, nullhandling=native, ascending=false}], offset=0, pagesize=3, pagenumber=0}}
is there else must change able use sorting , pagination ? can provide examples new implementation?
this class causes exception : org.neo4j.driver.v1.values
can see there no support pagerequest object in if/else clauses... using 'org.neo4j.driver', name: 'neo4j-java-driver', version: '1.1.0-m06' ....(lastest version)
i have tried both snapshot / public jars sdn https://repo.spring.io/libs-snapshot/org/springframework/data/spring-data-neo4j/4.2.0.m1/ , https://mvnrepository.com/artifact/org.springframework.data/spring-data-neo4j/4.2.0.m1
thanks sdn active community & jasper blues , issue solved. these steps follow :
1)make sure use springdataneo4j= "4.2.0.build-snapshot" , "neo_ogm="2.1.0-snapshot" dependencies. thoses following repositories : maven {url 'https://repo.spring.io/libs-snapshot'} maven {url 'http://m2.neo4j.org/content/repositories/snapshots'}
2) not change @enableneo4jrepositories @enableexperimentalneo4jrepositories , graphrepository neo4jrepository ... these changes not included in snapshot build.
3) pageable sorted result use code example:
pageable pageable = new pagerequest(0, 3, sort.direction.desc, "name"); page<owner> owners = ownerrepository.executemyquery(pageable);
everything works expected ! !!!
Comments
Post a Comment