alexanoid
alexanoid

Reputation: 25790

Neo4J Don't know how to compare that

I'm trying to implement simple Spring Neo4j repository function with a List parameter:

@Query("MATCH (c:Criterion) WHERE c IN {0} return c")
List<Criterion> getAllCriteria(List<Criterion> criteria);

After execution I'm getting following error:

org.neo4j.cypher.IncomparableValuesException: Don't know how to compare that. Left: Node[513]{name:"Test",description:"Test description"} (NodeProxy); Right: Criterion[id=513,name=Test,description=Test description] (Criterion)

Where I'm wrong ?

Upvotes: 1

Views: 328

Answers (2)

Michael Hunger
Michael Hunger

Reputation: 41676

Not sure that lists of parameters are converted. Single entities are converted into their id's.

So if you convert the Criterions into their graph-id's you can do:

@Query("MATCH (c:Criterion) WHERE ID(c) IN {0} return c")
List<Criterion> getAllCriteria(List<Long> criteria);

Upvotes: 1

cybersam
cybersam

Reputation: 66999

Try this:

@Query("MATCH (c:Criterion) WHERE ID(c) IN {0} return c")
List<Criterion> getAllCriteria(List<Criterion> criteria);

Even though this might work, your query does seems a bit odd, since the returned list would be equal to what you passed in.

Upvotes: 1

Related Questions