Return-Path: Delivered-To: apmail-incubator-cayenne-user-archive@locus.apache.org Received: (qmail 52016 invoked from network); 22 Apr 2006 05:32:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Apr 2006 05:32:43 -0000 Received: (qmail 61678 invoked by uid 500); 22 Apr 2006 05:32:42 -0000 Delivered-To: apmail-incubator-cayenne-user-archive@incubator.apache.org Received: (qmail 61662 invoked by uid 500); 22 Apr 2006 05:32:42 -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 61652 invoked by uid 99); 22 Apr 2006 05:32:42 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Apr 2006 22:32:42 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [63.193.104.70] (HELO purplekitty.pfrog.com) (63.193.104.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Apr 2006 22:32:41 -0700 Received: from localhost (localhost [127.0.0.1]) by purplekitty.pfrog.com (Postfix) with ESMTP id 1AE7F19AB1 for ; Fri, 21 Apr 2006 22:32:20 -0700 (PDT) Received: from purplekitty.pfrog.com ([127.0.0.1]) by localhost (purplekitty.pfrog.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 05734-10 for ; Fri, 21 Apr 2006 22:32:17 -0700 (PDT) Received: from [192.168.0.22] (gateway.pfrog.com [63.193.104.69]) by purplekitty.pfrog.com (Postfix) with ESMTP id E03F219A92 for ; Fri, 21 Apr 2006 22:32:16 -0700 (PDT) In-Reply-To: <006f01c66480$b7323430$14b2a8c0@PC> References: <570FE5C299B4CC4587C95EF5680619C1867DD6@FNHH-SVMEXDB003.Freenet-AG.de> <57E6EEB0-BA45-46CD-9341-2FDDF51D1156@objectstyle.org> <006f01c66480$b7323430$14b2a8c0@PC> Mime-Version: 1.0 (Apple Message framework v749.3) X-Priority: 3 Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <45B7A54B-6F3D-4918-BAB5-2C8F711D3194@pfrog.com> Content-Transfer-Encoding: 7bit From: Jeff de Vries Subject: Re: PK problem with Postgre Date: Fri, 21 Apr 2006 22:32:07 -0700 To: cayenne-user@incubator.apache.org X-Mailer: Apple Mail (2.749.3) X-Virus-Scanned: amavisd-new at pfrog.com X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I have had this problem as well. I'm using the "standard" value of 20 (meaning I haven't changed anything from the defaults), and I can see Cayenne query for the sequence value, followed by 20 insertions using a value incremented by Cayenne, etc. When the problem happens, I've gone and looked at the sequence value in the database, and found, say, a value of 740, but there is already an existing record with a value of 740 as a primary key, so when Cayenne fetches the db sequence value of 740 and tries to use it, I get the "duplicate key" error below. At this point I haven't been able to pinpoint any particular set of events leading up to the problem (other than occasionally we crash [for other reasons] and perhaps that leaves something funky?). In my pre-Cayenne days I always left the primary key field unspecified and let PostgreSQL handle the incrementing. Jeff On Apr 20, 2006, at 6:43 AM, WONDER wrote: > Hi, > > I have problem with PostGreSQL ver 8.1.3 using JDBC ver 8.2dev-501 > JDBC 3 > and Cayenne 1.2.B2. > > I use the Default Strategy to create the PKs using Cayenne. in the > DB, i > created the SEQ : pk_TableName. like pk_image for Table image. > > Sometimes I get the following error and sometimes it just work. > Till now, I coulding find the logic behind. > > Anybody can help? > Thanks. > > ------------------------------------------------- > Priority : INFO > > Class.Method(line): > org.objectstyle.cayenne.access.QueryLogger.logQueryError > (QueryLogger.java:43 > 9) > > Message: *** error. > > org.postgresql.util.PSQLException: ERROR: duplicate key violates > unique > constraint "image_pk" >