More data: The PrefetchSelectQuery appears to be correctly built when I examine it in the debugger, so this must have something to do with how it is translated into sql -- something I'll try to track down tomorrow.
prefetchQuery org.apache.cayenne.query.PrefetchSelectQuery (id=244) root org.apache.cayenne.map.ObjEntity (id=238) org.apache.cayenne.map.ObjEntity@bc9f8fb[name=ScheduledPayment] qualifier org.apache.cayenne.exp.parser.ASTAnd (id=236) (db:account.userAccountRelationshipList.user = <ObjectId:User, USER_ID=56>) and (db:account.userAccountRelationshipList.INVALIDATED = "N") and (db:INVALIDATED = "N") On Thu, Sep 26, 2013 at 8:29 PM, Mike Kienenberger <mkien...@gmail.com> wrote: > I have something that I believe is correctly adding the right prefetch > and the test I wrote passes, but some of my prefetches are putting the > qualifier on twice. This does not happen for every prefetch in the > same operation, only 2 of the 4 for the example query below: > > SELECT DISTINCT t0.* > FROM SCHEDULED_PAYMENT t0 > JOIN ACCOUNT t1 ON (t0.ACCOUNT_NUMBER = t1.ACCOUNT_NUMBER) > JOIN USER_ACCOUNT_RELATIONSHIP t2 ON (t1.ACCOUNT_NUMBER = t2.ACCOUNT_NUMBER) > WHERE (t2.USER_ID = ?) AND (t2.INVALIDATED = ?) AND (t0.INVALIDATED = > ?) AND (t0.INVALIDATED = ?) > [bind: 1:56, 2:'N', 3:'N', 4:'N']