Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 76939 invoked from network); 25 Aug 2008 09:34:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Aug 2008 09:34:13 -0000 Received: (qmail 45183 invoked by uid 500); 25 Aug 2008 09:34:11 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 45161 invoked by uid 500); 25 Aug 2008 09:34:11 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 45150 invoked by uid 99); 25 Aug 2008 09:34:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Aug 2008 02:34:11 -0700 X-ASF-Spam-Status: No, hits=-1999.8 required=10.0 tests=ALL_TRUSTED,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Aug 2008 09:33:14 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 32B9A234C1AC for ; Mon, 25 Aug 2008 02:33:44 -0700 (PDT) Message-ID: <1857416228.1219656824192.JavaMail.jira@brutus> Date: Mon, 25 Aug 2008 02:33:44 -0700 (PDT) From: "Michael Vorburger (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-701) Ability for fine-grained configuration of exclusion of foreign key columns in FetchPlan In-Reply-To: <2037070211.1219656704231.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12625288#action_12625288 ] Michael Vorburger commented on OPENJPA-701: ------------------------------------------- PS: This issue was created based on a discussion on users@openjpa.apache.org, see http://n2.nabble.com/Fetch-Group-questions-tp534861p681237.htm; quote Pinaki: "Once A has lots of to-one relations, it is a valid concern that A will store a lot of FK values in intermediate storage (perhaps without ever using them), but just wanted to underline that there is no significant performance penalty in such cases as the values are read from an existing row." > Ability for fine-grained configuration of exclusion of foreign key columns in FetchPlan > --------------------------------------------------------------------------------------- > > Key: OPENJPA-701 > URL: https://issues.apache.org/jira/browse/OPENJPA-701 > Project: OpenJPA > Issue Type: Improvement > Components: jdbc, sql > Affects Versions: 1.1.0 > Reporter: Michael Vorburger > Priority: Minor > > Currently (v1.1.0), "Even when a direct relation is not eagerly fetched, OpenJPA selects the foreign key columns and caches the values. This way when you do traverse the relation, OpenJPA can often find the related object in its cache, or at least avoid joins when loading the related object from the database. " (http://openjpa.apache.org/docs/latest/ref_guide_fetch.html#ref_guide_fetch_impl) > In a domain model with "wide" classes that have lot's of associations = foreign key columns on some tables, under a use case where you KNOW that you will not traverse some relations (because you know you'll only access 1-2 of many, configured by some upper layer, other getters may not even be available to end-code), it would be nice if the FetchPlan API was extended to allow for more fine-grained configuration of exclusion / inclusion of foreign key columns. > Design proposal, just an idea, could certainly be implemented differently: For backward compatibility, the current behaviour would likely have to stay as is. In addition however, a new method named e.g. FetchPlan.doNotIncludeAllForeignKeyColumns() [or a more suitable shorter name... :)] would cause the plan NOT to select any foreign key column by default. Only FK columns that were explicitly added via addField() would then be selected; if no fields in the referenced class are specified via another addField, then only the originating PK column would be included, if any field in the referenced class are also specified, then the JOIN would happen (as today - or would this simple API not suffice?). -- Minor: Ideally, an addField() for the association and another addField() for only the ID/PK attribute of the related class should not lead to a SQL JOIN either, as the ID/PK is in the original table of course, even if in the object model it's an attribute of the related class. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.