Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8D69A18E50 for ; Sat, 8 Aug 2015 11:16:24 +0000 (UTC) Received: (qmail 36275 invoked by uid 500); 8 Aug 2015 11:16:24 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 36244 invoked by uid 500); 8 Aug 2015 11:16:24 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 36233 invoked by uid 99); 8 Aug 2015 11:16:24 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Aug 2015 11:16:24 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 98FCBC0484 for ; Sat, 8 Aug 2015 11:16:23 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.981 X-Spam-Level: *** X-Spam-Status: No, score=3.981 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=3, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id hFVbOf8unnxs for ; Sat, 8 Aug 2015 11:16:14 +0000 (UTC) Received: from mail-03.1984.is (mail-03.1984.is [93.95.224.70]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 27B972055B for ; Sat, 8 Aug 2015 11:16:13 +0000 (UTC) Received: from localhost by mail-03.1984.is with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.84) (envelope-from ) id 1ZO24i-00012h-1y for user@cayenne.apache.org; Sat, 08 Aug 2015 11:14:04 +0000 From: Hugi Thordarson Content-Type: multipart/alternative; boundary="Apple-Mail=_5CA5671E-2F79-4A7D-916C-0E19788D3505" Subject: Prefetching all child nodes in a tree Message-Id: Date: Sat, 8 Aug 2015 11:14:03 +0000 To: user@cayenne.apache.org Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) X-Mailer: Apple Mail (2.2102) --Apple-Mail=_5CA5671E-2F79-4A7D-916C-0E19788D3505 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi all. Let=E2=80=99s say an entity has a self referencing relationship, = resulting in two modeled relationship definitions in the entity called = =E2=80=9Cparent=E2=80=9D and =E2=80=9Cchildren=E2=80=9D (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=E2=80=99m 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/ // s. 895-6688= --Apple-Mail=_5CA5671E-2F79-4A7D-916C-0E19788D3505--