KhanhTranVN
KhanhTranVN

Reputation: 13

How to set paramenters in neo4j?

This query always return all node with any proviName

@Query("START n=node:__types__(className='Province') WHERE n.name =~'.*{0}.*' RETURN n")
    List<Province> findEntitybyname(String proviName);

How can I fix it?

Upvotes: 1

Views: 75

Answers (1)

Michael Hunger
Michael Hunger

Reputation: 41676

Inside of a string or regexp no parameter substitution is performed, pass in your query as a string:

@Query("START n=node:__types__(className='Province') WHERE n.name =~ {0} RETURN n")
List<Province> findEntitybyname(String proviName);

repo.findEntitybyname('.*"+proviName+".*');

Upvotes: 1

Related Questions