Return-Path: Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 67667 invoked from network); 11 Feb 2003 14:59:12 -0000 Received: from moutng.kundenserver.de (212.227.126.187) by daedalus.apache.org with SMTP; 11 Feb 2003 14:59:12 -0000 Received: from [212.227.126.160] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 18ibsP-0001qO-00 for torque-user@db.apache.org; Tue, 11 Feb 2003 15:59:13 +0100 Received: from [217.5.50.200] (helo=lustig) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 18ibsP-00066V-00 for torque-user@db.apache.org; Tue, 11 Feb 2003 15:59:13 +0100 From: "Marc Lustig" To: "Turbine Torque Users List" Subject: AW: how to set the PK manually? Date: Tue, 11 Feb 2003 15:59:16 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 In-Reply-To: Importance: Normal X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Thanks Justin and Peter for your input, my statement "TABLE B extends TABLES A" didn't refer to the OO-terminology. table A actually respresents a base-user. table B represents a specific kind of a user. So both tables refer to the same kind of object, the user. Hence the PK of table B should reflect the PK that was created in table A. So my schema (table B) looks like this: Problem is still, when I setPrimaryKey(x) this PK will get lost once I call save(). torque generates a new PK. Q: Is there any other idMethod that I could use to tell torque not to generate any PK when save() is called? Or is the only way to add a regular PK and refer the USER-table by an additional column linked by a foreign-key reference? Thanks! Marc > -----Urspr�ngliche Nachricht----- > Von: Campbell, Justin [mailto:jcampbell@profilesys.com] > Gesendet: Dienstag, 11. Februar 2003 00:21 > An: 'Turbine Torque Users List' > Betreff: RE: how to set the PK manually? > > > Peter - > > I would argue whether or not primary keys are auto-generated by > definition. > This statement is true of "identity" (SQL Server terminology used here; > a.k.a. AutoNumber, ID, etc.) columns. However, a primary key can > consist of > one or more non-identity columns (e.g. a varchar(50) value). > > Personally, all my primary keys *are* identity columns (as this makes it > easier to isolate the actual "key" value and eases changes to the key > combination in the future), but this is not necessary (nor even > recommended > by some schools of thought in DB schema design). > > Just thought I'd clarify for folks out there as this statement may cause > confusion among the uninitiated. > > Best of luck. > > - Justin > > -----Original Message----- > From: Peter S. Hamlen [mailto:phamlen@mail.com] > Sent: Monday, February 10, 2003 6:22 PM > To: Turbine Torque Users List > Subject: Re: how to set the PK manually? > > > Marc, > > My understanding is that you cannot accomplish this if it's a primary > key. Primary keys, by their definition, are generated automatically so > that there aren't any duplicates. > > As Justin Campbell mentioned in a previous email, you might want to have > Table B have a foreign-key to table A (that's how most of us accomplish > this.) > > The other option (if you're really talking about "extending") is to add > the columns for B into table A - and add a "type" column that indicates > whether the object in the table is of type A or B. > > For example: > >
> > > > >
> > You can find more information about this in the "Inheritance" section of > Torque. > > -Peter > On Thu, 2003-02-06 at 13:20, Marc Lustig wrote: > > Hi, > > > > I'm creating a new instance (row) and set the PK to a certain value. > > (I need to do this because this table B extends another table > A, so the PK > > in table B must be the same as in table A.) > > > > My defaultIdMethod is "idbroker": > > > > > And to make torque not generating the PK I set idMethod="none": > > > > > > Problem is when I trigger save() torque still generates a new PK and > assigns > > it. How comes that? > > How can I make torque not to auto-generate a new primary key when save() > is > > called? > > > > Thanks! > > > > Marc > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org > > For additional commands, e-mail: torque-user-help@db.apache.org > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org > For additional commands, e-mail: torque-user-help@db.apache.org > > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org > For additional commands, e-mail: torque-user-help@db.apache.org >