From open-jpa-dev-return-2121-apmail-incubator-open-jpa-dev-archive=incubator.apache.org@incubator.apache.org Tue Feb 13 18:04:12 2007 Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 76129 invoked from network); 13 Feb 2007 18:04:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Feb 2007 18:04:10 -0000 Received: (qmail 17060 invoked by uid 500); 13 Feb 2007 18:04:16 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 17034 invoked by uid 500); 13 Feb 2007 18:04:16 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 17020 invoked by uid 99); 13 Feb 2007 18:04:16 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Feb 2007 10:04:16 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of hans.prueller@gmx.net designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 13 Feb 2007 10:04:06 -0800 Received: (qmail invoked by alias); 13 Feb 2007 18:03:45 -0000 X-Provags-ID: V01U2FsdGVkX1+keswGFCCkgpVg1pSxaNx8keoEkWcNJCUqkESwrq ZluQ== From: "Hans J. Prueller" To: Subject: AW: AW: Using @GeneratedValue for IDs on already existing tables Date: Tue, 13 Feb 2007 19:03:27 +0100 Message-ID: <00c101c74f99$4305e980$0600a8c0@burns> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 Thread-Index: AcdPjP/cdBfgIAMrSaGaWnQAmclx9QAAzDYgAABa+zAAAd+iwA== In-Reply-To: <7D856CDFE035FF45A0420ACBD71BDD63032E707E@repbex02.amer.bea.com> X-Y-GMX-Trusted: 0 X-Virus-Checked: Checked by ClamAV on apache.org Patrick, > It would certainly be possible to implement such a thing in OpenJPA, = but > there is no such feature in place currently. perhaps this would be a nice feature for the future - if I'll find = another working solution that avoids the case of generating an already existing = PK I don't need it. > If you're decommissioning the old system, one easy way to make things = work > would be to use a hi-lo table with per-class entries (the class-table > alias), and then manually configure the start value in the table = (using > the main() method in the = org.apache.openjpa.jdbc.kernel.ClassTableJDBCSeq) > to be the highest existing PK value for each table. this sounds good - thank you for the tip. regards, HANS > -----Urspr=FCngliche Nachricht----- > Von: Patrick Linskey [mailto:plinskey@bea.com] > Gesendet: Dienstag, 13. Februar 2007 18:13 > An: open-jpa-dev@incubator.apache.org > Betreff: RE: AW: Using @GeneratedValue for IDs on already existing = tables >=20 > > I can remember a legacy persistence framework that was able to retry > > the insert statement with a "second-try generated PK" just > > for the case > > the currently generated one has already been inserted by > > another process. >=20 > It would certainly be possible to implement such a thing in OpenJPA, = but > there is no such feature in place currently. >=20 > If you're decommissioning the old system, one easy way to make things = work > would be to use a hi-lo table with per-class entries (the class-table > alias), and then manually configure the start value in the table = (using > the main() method in the = org.apache.openjpa.jdbc.kernel.ClassTableJDBCSeq) > to be the highest existing PK value for each table. >=20 > -Patrick >=20 > -- > Patrick Linskey > BEA Systems, Inc. >=20 > = _______________________________________________________________________ > Notice: This email message, together with any attachments, may = contain > information of BEA Systems, Inc., its subsidiaries and = affiliated > entities, that may be confidential, proprietary, copyrighted = and/or > legally privileged, and is intended solely for the use of the = individual > or entity named in this message. If you are not the intended = recipient, > and have received this message in error, please immediately return = this > by email and then delete it. >=20 > > -----Original Message----- > > From: Hans J. Prueller [mailto:hans.prueller@gmx.net] > > Sent: Tuesday, February 13, 2007 9:01 AM > > To: open-jpa-dev@incubator.apache.org > > Subject: AW: AW: Using @GeneratedValue for IDs on already > > existing tables > > > > thanks for this link but this section only describes the different > > algorithms that are provided to get the generated value - it does > > not mention the case what happens if we try to save a new persistent > > entity with a generated PK value that already exists in the DB? > > > > I can remember a legacy persistence framework that was able to retry > > the insert statement with a "second-try generated PK" just > > for the case > > the currently generated one has already been inserted by > > another process. > > > > does nobody else have a similar requirement? > > > > hans > > > > > -----Urspr=FCngliche Nachricht----- > > > Von: Abe White [mailto:awhite@bea.com] > > > Gesendet: Dienstag, 13. Februar 2007 17:35 > > > An: open-jpa-dev@incubator.apache.org > > > Betreff: Re: AW: Using @GeneratedValue for IDs on already > > existing tables > > > > > > > does openJPA provide the strategy to re-generate another value = for > > > > the PK > > > > or do we have to manually deal with this case? > > > > > > http://incubator.apache.org/openjpa/docs/latest/manual/ > > > manual.html#ref_guide_sequence > > > > > ______________________________________________________________ > > _________ > > > Notice: This email message, together with any attachments, > > may contain > > > information of BEA Systems, Inc., its subsidiaries and > > affiliated > > > entities, that may be confidential, proprietary, > > copyrighted and/or > > > legally privileged, and is intended solely for the use of > > the individual > > > or entity named in this message. If you are not the > > intended recipient, > > > and have received this message in error, please immediately > > return this > > > by email and then delete it. > > > >