Return-Path: Delivered-To: apmail-db-jdo-dev-archive@www.apache.org Received: (qmail 97293 invoked from network); 5 Sep 2005 03:25:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Sep 2005 03:25:24 -0000 Received: (qmail 39123 invoked by uid 500); 5 Sep 2005 03:25:24 -0000 Mailing-List: contact jdo-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-dev@db.apache.org Received: (qmail 39109 invoked by uid 99); 5 Sep 2005 03:25:24 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Sep 2005 20:25:24 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=UPPERCASE_25_50 X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [192.18.98.34] (HELO brmea-mail-3.sun.com) (192.18.98.34) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Sep 2005 20:25:37 -0700 Received: from phys-mpk-1 ([129.146.11.81]) by brmea-mail-3.sun.com (8.12.10/8.12.9) with ESMTP id j853PLDB012159 for ; Sun, 4 Sep 2005 21:25:21 -0600 (MDT) Received: from conversion-daemon.mpk-mail1.sfbay.sun.com by mpk-mail1.sfbay.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) id <0IMB00M01Q9IWR@mpk-mail1.sfbay.sun.com> (original mail from Michelle.Caisse@Sun.COM) for jdo-dev@db.apache.org; Sun, 04 Sep 2005 20:25:21 -0700 (PDT) Received: from [129.150.64.68] (vpn-129-150-64-68.East.Sun.COM [129.150.64.68]) by mpk-mail1.sfbay.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) with ESMTP id <0IMB00C6LQU7IZ@mpk-mail1.sfbay.sun.com> for jdo-dev@db.apache.org; Sun, 04 Sep 2005 20:25:20 -0700 (PDT) Date: Sun, 04 Sep 2005 20:26:03 -0700 From: Michelle Caisse Subject: Re: TCK Schema : M-N relations In-reply-to: <431B72C8.5050706@spree.de> To: jdo-dev@db.apache.org Message-id: <431BBACB.1050507@sun.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040803 References: <200509032032.46354.andy@jpox.org> <065F314D-2F12-4D02-9BDB-746D98DD5225@Sun.COM> <200509040836.13401.andy@jpox.org> <431B6D51.5080508@spree.de> <431B72C8.5050706@spree.de> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi Michael, Michael Bouschen wrote: > Hi Craig, > >> Hi Michael, >> >> I believe that the patch applies to the other >> datastoreidentityschemafiles as well. > > > Yes, this is what I think, too. I will check in the change for all > datastoreidentity schema files unless I hear any objections. > >> >> Any idea why one join table uses this pattern: >> >> CREATE TABLE project_member ( >> PROJID INTEGER REFERENCES projects NOT NULL, >> MEMBER INTEGER REFERENCES persons NOT NULL); >> >> and others use this pattern? >> >> CREATE TABLE project_reviewer ( >> PROJID INTEGER NOT NULL, >> REVIEWER INTEGER NOT NULL >> ); >> ALTER TABLE project_reviewer >> ADD CONSTRAINT PR_PROJ_FK FOREIGN KEY >> (PROJID) REFERENCES projects(PROJID); >> >> ALTER TABLE project_reviewer >> ADD CONSTRAINT PR_REV_FK FOREIGN KEY >> (REVIEWER) REFERENCES persons(PERSONID); >> >> I guess the latter allows us to name the foreign key so it's easier >> to delete them by name. > I changed the table definitions and added the constraints in an ALTER TABLE statement so that we would have named constraints for a test. I don't remember which one now. That one form specifies the column list and the other defaults it is whimsy. > > No I have no idea. > > This is a good catch. I guess the first pattern creates a FK to the > column having the same name in the referenced table. When the column list is omitted the referenced column(s) is(are) the primary key of the referenced table. > But we want the FK to reference a different column called > DATASTORE_IDENTITY. Andys patch adds ALTER TABLE definitions for table > project_member, so we should skip the REFERENCES clause from its > definition: > CREATE TABLE project_member ( > PROJID INTEGER NOT NULL, > MEMBER INTEGER NOT NULL > ); > > What do you think? Yup. -- Michelle > > Regards Michael > >> >> Craig >> >> On Sep 4, 2005, at 2:55 PM, Michael Bouschen wrote: >> >>> Hi Andy, >>> >>> thanks for the patch! >>> >>> I think the changes also apply to the other datastoreidentity schema >>> files: schema[1-4].sql, since they have exactly the same problem. Am >>> I right? I have patched all 5 schema files in my workspace. I just >>> want to double check before I check in the changes. >>> >>> Regards Michael >>> >>> >>>> Hi Craig, >>>> >>>> >>>> >>>> >>>>> I'd be happy if you could propose a patch fixing the FK's. >>>>> >>>>> >>>>> >>>> >>>> patch is attached. Not raised a JIRA because in the time taken to >>>> raise the JIRA somebody could just have applied the patch >>>> >>>> >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> >>>> Index: test/sql/derby/datastoreidentity/schema.sql >>>> =================================================================== >>>> --- test/sql/derby/datastoreidentity/schema.sql (revision 267234) >>>> +++ test/sql/derby/datastoreidentity/schema.sql (working copy) >>>> @@ -167,12 +167,20 @@ >>>> ALTER TABLE project_reviewer ADD CONSTRAINT PR_PROJ_FK FOREIGN KEY >>>> - (PROJID) REFERENCES projects(PROJID); >>>> + (PROJID) REFERENCES projects(DATASTORE_IDENTITY); >>>> ALTER TABLE project_reviewer ADD CONSTRAINT PR_REV_FK FOREIGN KEY >>>> - (REVIEWER) REFERENCES persons(PERSONID); >>>> + (REVIEWER) REFERENCES persons(DATASTORE_IDENTITY); >>>> +ALTER TABLE project_member + ADD CONSTRAINT PM_PROJ_FK FOREIGN KEY >>>> + (PROJID) REFERENCES projects(DATASTORE_IDENTITY); >>>> + >>>> +ALTER TABLE project_member + ADD CONSTRAINT PM_MEMB_FK FOREIGN KEY >>>> + (MEMBER) REFERENCES persons(DATASTORE_IDENTITY); >>>> + >>>> ALTER TABLE departments ADD CONSTRAINT EMP_MO_FK FOREIGN KEY >>>> (EMP_OF_THE_MONTH) REFERENCES persons(DATASTORE_IDENTITY); >>>> >>>> >>>> >>>> >>> >>> >>> -- >>> Michael Bouschen Tech@Spree Engineering GmbH >>> mailto:mbo.tech@spree.de http://www.tech.spree.de/ >>> Tel.:++49/30/235 520-33 Buelowstr. 66 >>> Fax.:++49/30/2175 2012 D-10783 Berlin >>> >> >> Craig Russell >> >> Architect, Sun Java Enterprise System http://java.sun.com/products/jdo >> >> 408 276-5638 mailto:Craig.Russell@sun.com >> >> P.S. A good JDO? O, Gasp! >> >> > >