Return-Path: Delivered-To: apmail-cayenne-dev-archive@www.apache.org Received: (qmail 12986 invoked from network); 27 Sep 2008 11:43:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Sep 2008 11:43:02 -0000 Received: (qmail 66641 invoked by uid 500); 27 Sep 2008 11:43:00 -0000 Delivered-To: apmail-cayenne-dev-archive@cayenne.apache.org Received: (qmail 66626 invoked by uid 500); 27 Sep 2008 11:42:59 -0000 Mailing-List: contact dev-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list dev@cayenne.apache.org Received: (qmail 66615 invoked by uid 99); 27 Sep 2008 11:42:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 Sep 2008 04:42:59 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lachlan.deck@gmail.com designates 209.85.198.240 as permitted sender) Received: from [209.85.198.240] (HELO rv-out-0708.google.com) (209.85.198.240) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 Sep 2008 11:41:59 +0000 Received: by rv-out-0708.google.com with SMTP id c5so2204982rvf.52 for ; Sat, 27 Sep 2008 04:42:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=P9SJHw5wbzvMKlZIbOpWbFFrWugnju9WYCpM2aWQb6o=; b=SoBcruwMlOGL1Tao4eR2PHHyqbbSBja2wtSqn6/McCVD3gZGyX98Bn4W03ZNUnUgwR VgyGQj5rTpYT/e+KLV+jTUI/qILCmt897htF+VkVKEPjEQBeGlfTL6BVhI3H1B3NBbmk w5oCNGz7fa0bEZPTN6h4F3Pyj6Dn8/x8brffc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=lSFZ6JOMzXdO8B34ZyBDiSrOl0EE86uMso6RFTc4lUDqVQhietN2BNUIKAV7nJGxMA IU9uPkJhHwq1fwhzakwYtfIaigScpUBFsEIYsp8VGd4LmTa4dTVWbngeF6E9NPJBRXNg yeL85QpFWCffYe6eanlwuqXgL51A53tJ/ZcbA= Received: by 10.142.230.9 with SMTP id c9mr1109561wfh.343.1222515753536; Sat, 27 Sep 2008 04:42:33 -0700 (PDT) Received: from ?10.0.1.200? ( [220.233.198.208]) by mx.google.com with ESMTPS id 28sm7176442wfg.15.2008.09.27.04.42.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 27 Sep 2008 04:42:33 -0700 (PDT) Message-Id: From: Lachlan Deck To: dev@cayenne.apache.org In-Reply-To: <1839A675-E6E8-4194-8AF3-4281818C4CB4@objectstyle.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Subject: Re: Another take on inheritance Date: Sat, 27 Sep 2008 21:42:28 +1000 References: <1839A675-E6E8-4194-8AF3-4281818C4CB4@objectstyle.org> X-Mailer: Apple Mail (2.929.2) X-Virus-Checked: Checked by ClamAV on apache.org On 26/09/2008, at 5:09 AM, Andrus Adamchik wrote: > No guarantee that it won't end up being just another mailing list > discussion with no code committed, but giving it another shot. > Myself and Dzmitry Rusak (he hasn't participated on this list, but > hopefully he will over time; he is the guy who developed DataMap > generator templates that create named query methods) have been > looking at the CAY-795 Jira and Marcin's patch to implement > horizontal inheritance, with the goal to advance this task further. > > We discussed ORM inheritance in general, possible approaches to the > mapping, and just touched a bit on the runtime. For me it was > helpful to realize that there is no spoon :-) For all the talk about > single-table, vertical and horizontal inheritance, Cayenne runtime > will end up dealing with a hybrid case of any possible combination > of the above in each given hierarchy. So the terminology will be > different when we get to nuts and bolts of the mapping: ObjEntity to > DbEntity mapping; ObjEntity qualifier; ObjAttribute overrides in > subclasses. These are the three pieces that allow inheritance to > happen in the mapping (all 3 types of inheritance). > > Let me come back to this in a moment... Now a note on > implementation. I'd like to follow an approach that proved itself > with other features: > > (1) implement new features needed in the mapping layer (including > save/load) > (2) implement Modeler support for that (although that can be > postponed till after #3 as to avoid early exposing of the incomplete > features to the end users) > (3) implement runtime support for select / select relationship / > insert / update / delete, with unit tests > (4) do #3 for ROP > > So essentially this is going layer by layer instead of cutting > across, and when we get to runtime parts, we already have a mapping > framework to create the test cases. The plan is to bypass Marcin's > patch (that has code across the layers) and start with (1) and (2). > For #1, some preliminary work has been done by Ari and Marcin > (CAY-794), so now we need to relax some mapping restrictions (coming > from assuming that all inheritance == single table inheritance) and > introduce a new concept of ObjAttribute overrides. It exists in JPA > (for the same purpose of mapping inheritance), and so far has been > absent from Cayenne (except for the embeddables that are still > somewhat hidden from the public view by the absent Modeler support). > > Once we have that, we can move to the runtime pieces... That's where > the real fun starts... Consider that to fetch superclass in case of > horizontal inheritance, we'd need to do separate queries on each > subclass on the tree, and then combine the result in an in-memory > "union" and then apply in-memory sort ordering on top of that :-) This last one may not require separate queries for each subclass. i.e., by definition horizontal inheritance ensures that each sub- entity has the super's attributes/relations in common. So I'd think you ought to be able to do a unioned fetch of these things across the immediate child entities and lazy fault anything unique to the child entities thereafter... no? with regards, -- Lachlan Deck