I have two classes such:
@NodeEntity
public class A implements Comparable<A>{
@GraphId Long nodeId;
@Indexed String name;
@RelatedTo(type="MEMBERS") Set<B> b_collection;
@RelatedTo(type="PARENT_OF") Set<A> children;
@Fetch @RelatedTo(type="PARENT_OF", direction=Direction.INCOMING) A parent;
}
@NodeEntity
public class B {
@GraphId protected Long nodeId;
@Indexed(level = Indexed.Level.GLOBAL) String hash;
@Indexed(level = Indexed.Level.INSTANCE) String name;
@RelatedTo(type="MEMBERS", direction = Direction.INCOMING) Set<A> a_collection;
}I have a repository method:
B findByAsNameAndHash(String aName, String hash);
This method works fine. It finds the instance of
B with a given
hash, as long as it is in the
b_collection of an instance of
A with the given
name.
What I would like is a second method that does the same, except it would also look in the
b_collection of not only the
A instance with the given
name, but all
A related to the matched
A via the
parent attribute. Effectively, what I want is to find the given
A, create a union set of
b_collection with all those up the
parent hierarchy, then find the matching
B in that union set, if it exists.
Is this possible?