On 18/12/2013 4:29am, Michael Hatch wrote: > The first sql statement is fetching the user info, while the second sql is > for inflating the roles relationship. I understand the documentation > explicitly states that prefetching will inflate relationships for you, but > it still does so via multiple sql commands per relationship, instead of via > a single sql statement with an inner join. Did I simply do something wrong > somewhere?
Cayenne will automatically decide whether to issue multiple SQL requests (disjoint prefetch) or one big SQL statement which captures all the data (joint). Don't assume without testing which one will be better for your needs, and Cayenne does allow you to choose which sementics to use. But SelectQuery will be disjoint by default. Imagine for a moment: to-many joins to 5 tables from a source table on which you want to use a joint prefetch. You can very quickly return a vast number of rows using an outer join in this way. Ari -- --------------------------> Aristedes Maniatis GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A