Return-Path: Delivered-To: apmail-cayenne-dev-archive@www.apache.org Received: (qmail 45082 invoked from network); 31 May 2010 11:49:09 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 31 May 2010 11:49:09 -0000 Received: (qmail 31802 invoked by uid 500); 31 May 2010 11:49:09 -0000 Delivered-To: apmail-cayenne-dev-archive@cayenne.apache.org Received: (qmail 31699 invoked by uid 500); 31 May 2010 11:49:08 -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 31691 invoked by uid 99); 31 May 2010 11:49:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 May 2010 11:49:07 +0000 X-ASF-Spam-Status: No, hits=-0.6 required=10.0 tests=AWL,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mkienenb@gmail.com designates 209.85.212.43 as permitted sender) Received: from [209.85.212.43] (HELO mail-vw0-f43.google.com) (209.85.212.43) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 May 2010 11:49:02 +0000 Received: by vws3 with SMTP id 3so526122vws.16 for ; Mon, 31 May 2010 04:48:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=/0k+EmZ4mwWmGifTXCvignDUmHWBkl1g9xan9/iqZwo=; b=Pn60fugEnV80imFLIy3cjC+tr+Ar2wFR8BVOvpHDGsNwaVW72tHdD1akGXCdkP0yNz xVEo0ZDoDfD/yxSUHJEWJGlI32KZuwayWBMtD4TGaOpgJFtbXCpUErEiBU5rREZ605ke xN9bQpkB0GFecA93+uSsUP9pHKxasDNlYK9yc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=ck3Fq14DoTYWgFdpYhjiYbVVqmZvHygkLveTdhrd42s+cDHdNIMawPnq0OdzDQDgee 7W/KVItYy88j0C6jf4dtOe/hd0rx+R5swWuOGfx0ay03NKgV/U1HcGAovVi6MQ/UW55x UzQ/q+2FZoDz+h6d10rGkLvYUYleENx2KtmiM= Received: by 10.224.78.222 with SMTP id m30mr1548092qak.350.1275306521213; Mon, 31 May 2010 04:48:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.40.16 with HTTP; Mon, 31 May 2010 04:48:21 -0700 (PDT) In-Reply-To: References: <0C62EB6A-3BE7-4DBC-8F9E-265332E9954D@objectstyle.org> From: Mike Kienenberger Date: Mon, 31 May 2010 07:48:21 -0400 Message-ID: Subject: Re: Vertical inheritance To: dev@cayenne.apache.org Content-Type: text/plain; charset=ISO-8859-1 Here's what we're using for JPA: // Contact Detail (root) @Inheritance(strategy = InheritanceType.JOINED) @DiscriminatorColumn(name="object_type") @PrimaryKeyJoinColumn(name="id", referencedColumnName="id") // Address (subclass) @DiscriminatorValue("ADR") I guess JPA allows another approach, which would be to specify sql for each subclass instead of a column value. Reviewing what's out there already for single-table inheritance (which I've never used before), I don't see any changes that are needed. Everything that works for single-table seems to be sufficient and necessary for vertical inheritance. As far as I can tell, the implementation difference between single-table and vertical is only that multiple tables are involved in the queries for reading and writing the data. I didn't completely understand the question, so I'm not sure if this answers it. As I read through the JPA specs, I note that it does not support mixed inheritance types for a set of tables as a required feature. This could be future work if we decided we wanted to support it. On Sun, May 30, 2010 at 1:44 PM, Andrus Adamchik wrote: > Approaches to Mapping Inheritance > --------------------------------- > > Currently we don't require users to specify inheritance semantics > explicitly. We guess it instead (not unlike EOF). Just select a superclass > ObjEntity and (optionally) subclass DbEntity and we'll derive the rest. In > case of vertical inheritance I wrote the code to determine the inheritance > DbRelationship out of all relationships between the super and sub tables > (1..1 PK-based relationship). > > JPA for instance does require explicit inheritance semantics property set on > the superclass. Should we do the same for sanity sake? E.g. to prevent > unsupported combinations of inheritance types in a single hierarchy. I don't > know what those unsupported combinations will be at the end (i.e. how smart > our algorithms will end up being and how extensive the test suite we'll have > to say what is supported and what's not). Having a hard rules (with > validation done by the Modeler) will make things much less ambiguous (at the > expense of some flexibility). E.g. back in the EOF days I barely used > inheritance, as it was all based on implicit mapping rules between super and > subclasses, so I never bothered to understand them (did it also require to > flatten super attributes?? My current design won't). > > Thoughts on that?