Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 94237 invoked from network); 17 Apr 2004 23:08:03 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 17 Apr 2004 23:08:03 -0000 Received: (qmail 47668 invoked by uid 500); 17 Apr 2004 23:07:47 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 47641 invoked by uid 500); 17 Apr 2004 23:07:47 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "OJB Developers List" Reply-To: "OJB Developers List" Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 47622 invoked from network); 17 Apr 2004 23:07:46 -0000 Received: from unknown (HELO mail.fridayfives.net) (209.137.167.162) by daedalus.apache.org with SMTP; 17 Apr 2004 23:07:46 -0000 Received: from kamajii.forthill.int (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 3DB871F458 for ; Sat, 17 Apr 2004 19:07:51 -0400 (EDT) Received: from filter.fridayfives.net (freki.forthill.int [192.168.1.43]) by mail.fridayfives.net (Postfix) with ESMTP id DA5CB1F452 for ; Sat, 17 Apr 2004 19:07:50 -0400 (EDT) Received: by filter.fridayfives.net (Postfix, from userid 5054) id CB2166FC83; Sat, 17 Apr 2004 19:01:51 -0400 (EDT) Received: from freki (freki [127.0.0.1]) by freki (Postfix) with SMTP id DC7176FC87 for ; Sat, 17 Apr 2004 19:01:49 -0400 (EDT) Received: from [172.20.1.50] (pcp03522784pcs.limstn01.de.comcast.net [68.39.64.92]) by filter.fridayfives.net (Postfix) with ESMTP id 4D1956FC83 for ; Sat, 17 Apr 2004 19:01:48 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v613) In-Reply-To: <40815D3C.90802@apache.org> References: <44F4042C-8FA3-11D8-9D39-000A95782782@forthillcompany.com> <40815D3C.90802@apache.org> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <057045EA-90C4-11D8-8E5B-000A95782782@forthillcompany.com> Content-Transfer-Encoding: 7bit From: Brian McCallister Subject: Re: Reference Fetching and Joins in 1.1 Date: Sat, 17 Apr 2004 19:07:38 -0400 To: "OJB Developers List" X-Mailer: Apple Mail (2.613) X-Spam-Status: No, hits=-6.7 required=4.5 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_APPLEMAIL autolearn=ham version=2.55 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N I like it! -Brian On Apr 17, 2004, at 12:37 PM, Armin Waibel wrote: > Hi Brian, > > Brian McCallister wrote: >> A couple thoughts on the JDBC access and collection fetching/proxying >> going forward: >> First is the ability to programmatically define auto-retrieves via >> something like: >> QueryByCriteria query = QueryFactory.newQuery(Foo.class, new >> Criteria()); >> query.prefetch("foo.bar, foo.bar.waffle, foo.eggs"); > > +1 This looks very smart to me. > >> This would specify to retrieve the bar collection on foo, the waffle >> collection on each instance in bar, and the eggs collection on foo, >> regardless of what the mapping metadata says. > > I'm currently try to implement a prototype of a feature discussed with > Robert S. Sfeir some weeks ago. This will allow to dynamically change > the metadata reference setting at runtime. If we have such an feature > it will be no problem to implement your suggestion. > > It will work like this: > > // get the RuntimeBinder instance > RuntimeRegistry rdr = (RuntimeRegistry) > broker.serviceBrokerHelper().runtimeBinder(); > // create new RuntimeDescriptor instance > RuntimeDescriptor rd = rdr.newRuntimeDescriptor(); > // set changes for the reference > rd.setAutoRetrieve(true); > // bind descriptor and substitute the declared behaviour > rdr.bindRuntimeDescriptor(rd, Foo.class, "bar"); > ... > ... > rdr.unbindAll(); // or the PB.close() call > // unbind all RuntimeDescriptor > > So it will be no problem to implement your suggestions using this new > feature ;-) > > What do you think? > > The only problem is the cache. The user has take care of the cached > objects, because the cache contains now objects based on the runtime > reference settings (e.g. without loaded references). So if default is > auto-retrieve 'true' and you set 'false' the cache will contain > objects without loaded references. In that case user should use the > 'refresh' attribute for all references. > > regards, > Armin > >> Second, and Jakob shot me down on this once (but I'm going to try >> again anyway), is retrieving referenced collections via a join: >> foo.bar can be done via: >> select foo.id, foo.prop, bar.id, bar.fooId, bar.prop from foo left >> outer join bar on foo.id = bar.fooId; >> as well as the current: >> select foo.id, foo.prop from foo; >> select bar.id, bar.prop, bar.fooId from bar where bar.fooId = ?; >> It gets entertaining to construct objects from the results, but the >> ability to fetch via the join is usually a benefit over multiple >> queries -- when the database supports the left outer join. The >> queries also get entertaining when you have collections on bar which >> should also be in the same join. >> The behavior of how to retrieve a referenced collection (join vs >> separate select) should be in metadata, and joins would need to be >> quietly converted to multiple selects on platforms where outer joins >> are not supported. >> Thoughts, opinions? >> -Brian >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org >> For additional commands, e-mail: ojb-dev-help@db.apache.org > > --------------------------------------------------------------------- > To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org > For additional commands, e-mail: ojb-dev-help@db.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For additional commands, e-mail: ojb-dev-help@db.apache.org