I have two class: A & B. A has a collection of B's.
I have a repository method:Code:@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; }
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.Code:B findByAsNameAndHash(String aName, String hash);
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 realted to the matched A via the parent attribute. Effectivly, what I want to 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?


Reply With Quote
