We are using Cayenne with something like
ResultIterator<SomeMain> lvSomeMainList = ObjectSelect
.query(Anlstamm.class)
.and(SomeMain.ORGUNIT_NR.eq(pvOrgUnitNr))
.prefetch(SomeMain.RELATION1.joint())
.prefetch(SomeMain.RELATION2.joint())
.prefetch(SomeMain.RELATION3.joint())
.iterator(gvContext);
for (SomeMain bvSomeMain: lvSomeMainList) {
bvSomeMain.getMethod_relation1();
...
}
Cayenne executes the correct joins on DB-Level but instead of fully resolve bvSomeMain, getMethod_relation1 triggers a new select with the already prefetched RELATION1.
We are using Apache Cayenne 4.0
Thanks for a hint.