[Neo4j] Spring Data Graph 2.0.0 and Cypher queries using Repositories

Andres Taylor andres.taylor at neotechnology.com
Wed Oct 26 00:56:58 CEST 2011


Hi Tero,

This has changed because Cypher now supports parameters. SDN used to
hand-craft your query strings for you, but now it uses Cypher parameter
instead. And Cypher doesn't support params in these areas.
It definitely should.

Andrés





On Mon, Oct 24, 2011 at 9:41 PM, Tero Paananen <tpp+neo4j at iki.fi> wrote:

> I just upgraded to Spring Data Graph for Neo4J 2.0.0.M1 and it
> looks like certain things changed for the worse for my needs.
>
> Just looking for clarification of whether these changes are
> permanent or to be addressed before final release.
>
> I'm using Cypher queries defined in Repository classes, e.g.:
>
> @Repository
> public interface CustomRepository extends GraphRepository<User> {
>   @Query(value = "start u = node:user(name = '%foo') match
> (u)-[:KNOWS*1..%depth]->() return u", type = QueryType.Cypher)
>   Iterable<User> getConnections(@Param("foo") String foo, @Param("depth")
> Integer depth);
> }
>
> This used to work just fine in 1.1.0.RELEASE.
>
> In 2.0.0.M01 %foo should be {foo} and %depth produces a syntax
> error regardless of whether I specify it with %depth or {depth}.
> Same with skip and limit instructions:
>
> .. return u skip %skip limit %limit
>
> used to work just fine, however
>
> .. return u skip {skip} limit {limit}
>
> no longer works.
>
> I know I could probably replicate this behavior using the
> Neo4JTemplate functionality, but I'm not sure that's actually
> a better way of doing that, considering how convenient it is
> to create queries with the @Query annotation.
>
> Your thoughts? And what would be my best options for alternatives
> at this point?
>
> Thanks!
>
> -TPP
> _______________________________________________
> Neo4j mailing list
> User at lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>


More information about the User mailing list