I've got an object of the class A in 2 ways relationships with objects of classes B, C and D.
So I could do (with "a" an object of type A):
B b = a.getB();
A a1 = a.getB().getA(); // and a1 would be equal to a
When I do a SelectQuery on A with prefetchs on the relationship from A to B, C and D, all is fine. But If I add a prefetch on the relationship from B to A, then A lose the relationship from A to C and D or it doesn't do anything. I mean by "lose" that they have been invalidated.
Is that normal? Why is it so?
Notes: I'm using Cayenne 3.0.2 and disjoint prefetchs semantics.
Example 1 (as explained above):
SelectQuery query = new SelectQuery(A.class);
query.addPrefetch("b").setSemantics(PrefetchTreeNode.DISJOINT_PREFETCH_SEMANTICS);
query.addPrefetch("c").setSemantics(PrefetchTreeNode.DISJOINT_PREFETCH_SEMANTICS);
query.addPrefetch("d").setSemantics(PrefetchTreeNode.DISJOINT_PREFETCH_SEMANTICS);
query.addPrefetch("b.a").setSemantics(PrefetchTreeNode.DISJOINT_PREFETCH_SEMANTICS);
List<?> res= context.performQuery(query);
Example 2 (which is probably the same problem):
SelectQuery query = new SelectQuery(A.class);
query.addPrefetch("b").setSemantics(PrefetchTreeNode.DISJOINT_PREFETCH_SEMANTICS);
query.addPrefetch("c").setSemantics(PrefetchTreeNode.DISJOINT_PREFETCH_SEMANTICS);
List<?> res= context.performQuery(query);
then later
SelectQuery query = new SelectQuery(A.class);
query.addPrefetch("d").setSemantics(PrefetchTreeNode.DISJOINT_PREFETCH_SEMANTICS);
List<?> res= context.performQuery(query);
then the relationships with b and c are invalidated or the last prefetch is ignored. Sometimes b and c would be set to null though they are not null.
thanks