Hi all. Let’s say an entity has a self referencing relationship, resulting in two modeled relationship definitions in the entity called “parent” and “children” (hopefully pretty self-explanatory).
Using Cayenne, is it possible, given a record (a node in the tree) to perform a prefetch so that all child nodes are prefetched? I’m currently doing this (where I just go as deep as I think the tree will be) which seems to work fine, but feels a little wonky :) query.addPrefetch( Item.CHILDREN.joint() ); query.addPrefetch( Item.CHILDREN.dot( Item.CHILDREN ).joint() ); query.addPrefetch( Item.CHILDREN.dot( Item.CHILDREN ).dot( Item.CHILDREN ).joint() ); query.addPrefetch( Item.CHILDREN.dot( Item.CHILDREN ).dot( Item.CHILDREN ).dot( Item.CHILDREN ).joint() ); Cheers, - hugi // Hugi Thordarson // http://www.loftfar.is/ <http://www.loftfar.is/> // s. 895-6688