I'm having troubles with part of my project which uses spring-data-neo4j. I've got node entity class:
@NodeEntity
@TypeAlias("Ad")
public class Ad{
@GraphId
private Long nodeId;
@Indexed(indexName = "adId", unique = true)
private Long id;
@Fetch
@RelatedTo(type="CONTAINS", direction = Direction.OUTGOING)
private Collection<Keyword> keywords;
...
And repository for it with such methods:
@Query(value = "START ad1=node({adv}) MATCH ad1-[r1:CONTAINS]->Keyword<-[r2:CONTAINS]-similar RETURN similar SKIP {param_offset} LIMIT {param_limit}")
Iterable<Ad> findSimilarAds(@Param("adv") Ad advertising, @Param("param_limit") int limit, @Param("param_offset") int offset);
@Query(value = "START ad1=node:adId(id={p_id}) MATCH ad1-[r1:CONTAINS]->Keyword<-[r2:CONTAINS]-similar RETURN similar SKIP {param_offset} LIMIT {param_limit}")
Iterable<Ad> findSimilarAdsById(@Param("p_id") Long id, @Param("param_limit") int limit, @Param("param_offset") int offset);
And then test, which do just something like this:
create Keyword 1, create Keyword 2 - ok
create Ad node with id 123456 containing Keyword 1 and Keyword 2 - ok
create Ad node with id 654321 containing Keyword 1 - ok
get Ad with id 654321 - works ok, generated query is:
START
ad
=node:adId
(id
={0}) RETURNad
params {0=654321}get similar ads with findSimilarAds() and argument is the Ad from previous step - works good, it returns Ad with id 123456, generated query:
START ad1=node({adv}) MATCH ad1-[r1:CONTAINS]->Keyword<-[r2:CONTAINS]-similar RETURN similar SKIP {param_offset} LIMIT {param_limit} params {param_offset=0, param_limit=10, adv=48}
after that, get similar ads with findSimilarAdsById() method - the id argument is 654321L. The result query looks like this:
START ad1=node:adId(id={p_id}) MATCH ad1-[r1:CONTAINS]->Keyword<-[r2:CONTAINS]-similar RETURN similar SKIP {param_offset} LIMIT {param_limit} params {param_offset=0, p_id=654321, param_limit=10}
But It is returning empty org.springframework.data.neo4j.conversion.QueryResultBuilder instance (i'm trying trying to get elements with iterator) instead of Iterable collection with Ad 123456. I've tried almost everything i could think of, withou any success, am I missing something important?
Versions:
- spring-data-neo4j 2.3.3.RELEASE
- neo4j-cypher-dsl 1.8
- spring stuff 3.1.4.RELEASE
- spring-data-neo4j-aspects 2.3.2.RELEASE