Return-Path: Delivered-To: apmail-incubator-cayenne-user-archive@locus.apache.org Received: (qmail 28725 invoked from network); 13 Jul 2006 16:41:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 Jul 2006 16:41:34 -0000 Received: (qmail 25434 invoked by uid 500); 13 Jul 2006 16:41:33 -0000 Delivered-To: apmail-incubator-cayenne-user-archive@incubator.apache.org Received: (qmail 25299 invoked by uid 500); 13 Jul 2006 16:41:33 -0000 Mailing-List: contact cayenne-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cayenne-user@incubator.apache.org Delivered-To: mailing list cayenne-user@incubator.apache.org Received: (qmail 25290 invoked by uid 99); 13 Jul 2006 16:41:33 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Jul 2006 09:41:33 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [167.206.4.202] (HELO mta7.srv.hcvlny.cv.net) (167.206.4.202) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Jul 2006 09:41:32 -0700 Received: from [192.168.0.100] (ool-18bc8919.dyn.optonline.net [24.188.137.25]) by mta7.srv.hcvlny.cv.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTP id <0J2C00ADKP0NVA00@mta7.srv.hcvlny.cv.net> for cayenne-user@incubator.apache.org; Thu, 13 Jul 2006 12:41:11 -0400 (EDT) Date: Thu, 13 Jul 2006 12:41:12 -0400 From: Andrus Adamchik Subject: Re: UUID as primary key In-reply-to: To: cayenne-user@incubator.apache.org Message-id: <96D76C52-28C1-4D40-97E8-EC8257316F6F@objectstyle.org> MIME-version: 1.0 X-Mailer: Apple Mail (2.752.2) Content-type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Content-transfer-encoding: quoted-printable References: <110DED9F5106CC47A186602C0DD3938201168C95@EXVF.fanniemae.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Jul 13, 2006, at 12:32 PM, =D8yvind Harboe wrote: > On 7/12/06, Gentry, Michael (Contractor) =20 > wrote: >> You could override setPersistenceState() in your Treatment class: >> >> public void setPersistenceState(int state) >> { >> super.setPersistenceState(state); >> >> // If object was just created, set PK >> if (state =3D=3D PersistenceState.NEW) >> setId(UUID.randomUUID()); >> } > > Hmmm... I tried that, but setPersistanceState() is invoked multilple > times with state=3DNEW and thus I'm changing the UUID each time. That > can't be right. No it can't - it should only be invoked once per object. Andrus=