2016-08-01 14 views
3

Ich versuche Pageable Unterstützung für meine benutzerdefinierte Cyper Abfrage über SDN 4 Repository Methode vorstellen:Spring Data Neo4j 4 und Pageable @QueryResult

@Query(value = "MATCH (parentD)-[:CONTAINS]->(childD:Decision)-[ru:CREATED_BY]->(u:User) WHERE id(parentD) = {decisionId} OPTIONAL MATCH (childD)<-[:VOTED_FOR]-(vg:VoteGroup)-[:VOTED_ON]->(c:Criterion) WHERE id(c) IN {criteriaIds} WITH childD, ru, u, vg.avgVotesWeight as weight RETURN childD AS decision, ru, u, sum(weight) as weight ORDER BY weight DESC", countQuery="MATCH (parentD)-[:CONTAINS]->(childD:Decision) WHERE id(parentD) = {decisionId} RETURN count(childD)") 
Page<WeightedDecision> getChildDecisionsSortedBySumOfCriteriaAvgVotesWeight(@Param("decisionId") Long decisionId, @Param("criteriaIds") Set<Long> criteriaIds, Pageable pageable); 

WeightedDecision ist ein @QueryResult:

@QueryResult 
public class WeightedDecision { 

    private Decision decision; 

    private double weight; 

    public Decision getDecision() { 
     return decision; 
    } 

    public void setDecision(Decision decision) { 
     this.decision = decision; 
    } 

    public double getWeight() { 
     return weight; 
    } 

    public void setWeight(double weight) { 
     this.weight = weight; 
    } 

} 

Im Augenblick schlägt diese Logik mit einer ClassCastException Ausnahme fehl:

Was mache ich falsch und wie repariere ich es?

+0

Reproduziert dieses Problem als Fehler in OGM (oder eher SDN). An einer Lösung arbeiten. Sie auf dem Laufenden halten. –

Antwort

4

Version 2.0.4 von SDN unterstützt kein Paging für @QueryResult s. Version 2.0.5 wird unterstützen, und die Funktion ist für UAT im Snapshot-Build-Repository verfügbar.

+0

Ich möchte bestätigen, dass es jetzt mit OGM 2.0.5-SNAPSHOT und SDN 4.2.0-BUILD-SNAPSHOT funktioniert. Vielen Dank !!! – alexanoid