Hi Andrus,
The explination from Jeff matches my observations. So answering your
question is Yes. I saw that problem with 1.2B2 also.
Sako
----- Original Message -----
From: "Andrus Adamchik" <andru..bjectstyle.org>
To: <cayenne-use..ncubator.apache.org>
Sent: Saturday, April 22, 2006 9:23 AM
Subject: Re: PK problem with Postgre
> Jeff,
>
> I am not sure if there was a race condition before, but since ~ M12-
> B1 PK generator operates under slightly different conditions, being
> tied to the commit transaction in progress. So have you seen this
> problem recently?
>
> Andrus
>
>
> On Apr 22, 2006, at 9:32 AM, Jeff de Vries wrote:
>
> > 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"
> >>
> >
> >
>
>
This archive was generated by hypermail 2.0.0 : Sat Apr 22 2006 - 05:37:12 EDT