> I am wondering if there is any possibility to build an interface query in
> the repository like this, where I can pass additional filter criteria by
> string argument
>
> @Query("start item=node:ProductItem(tpg = \"{0}\") where {1} return
> item")
> Iterable<ProductItem> findByTpgFiltered(String tgp, String filter);
>
> when giving additional filters like findByTpgFiltered("XYZ", "
item.name <>
> \"itemA\"");
> I get an error.
> What would be a better way to do that?
Since your query is so simple, I think the easiest way would be to build
they query string at runtime and execute it using Neo4jTemplate.
String query = String.format("start item = node:ProductItem(tpg =
\"%s\") where %s return item", tpg, filter);
Result<Map<String, Object>> result = template.query(query, new
HashMap<String, Object>());
return
result.to(ProductItem.class);
There should be examples of how to use Neo4jTemplate with SDN
on the mailing list or the SDN docs. You should be able to inject
the Neo4jTemplate into whatever classes you have accessing
Neo4j via SDN.
-TPP