I'm sorry I didn't make it completely clear: I'm using cayenne 1.2B2 (see subject line).
GMail cut off the subject... sorry bout that :)
Also, I'm very thankfull for the hint about prefetch semantics: I didn't really think about what was going on under the hood, up untill now. I gave PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS a try and got *exactly* the join I wanted: QueryLogger: SELECT (...t0.fieldlist, t1.fieldlist...) FROM main.first_table t0, main.second_table t1 WHERE t0.id = t1.id AND (t0.attr ILIKE ?) LIMIT 50 [bind: '%a%'] - prepared in 18 ms. Now, the problem is that not knowing about prefetch semantics, I expected the prefetch to *just work* i.e. deduce which records in the other table I really require, instead of fetching all of them. I still think there's no use case to support the default prefetch behaviour that gave me problems in the first place: if the query on the primary table is limited to no more than a 100 records, why would the prefetch go for all the records of the secondary table?
The reason is that if you were including certain expressions, you might find that the prefetch didn't include all results, meaning a getRelationshipArray call on your base object could deceivingly return less than the number of results that are actually present. This has been documented in a few bugs and on the list, and is definitely a priority, but quite difficult to actually fix :) http://issues.apache.org/cayenne/browse/CAY-319 Maybe you could submit a bug report about this, though... the semantics should be detected correctly most of the times, and this might be a time where it could have been detected better. Would have to look in greater detail to be sure. Cris
