> I'm looking for ideas to debug, ideas on how likely it is that
> Cayenne and the database have differing takes on what the next
> primary key should be and things like that.
That's what I suspect too... Sequence increment must be the same in
DB and in Cayenne model (note that in Cayenne increment is 20 by
default, unless you change it per entity). Did you create sequences
using the modeler, or by hand?
In any event you can drop and recreate the sequences again. Since you
already have some data, you will need to set the initial value. The
syntax is described in this Jira issue (that we need to add to
Cayenne eventually)
http://issues.apache.org/cayenne/browse/CAY-401
Andrus
On Sep 7, 2006, at 2:46 AM, Arturo Pérez wrote:
> Hi all,
>
> Using cayenne 1.2, Tomcat 5.0 and pgSQL 8.1.4 on Linux.
>
> I'm having a problem where sequence numbers are being reused
> as primary keys. I have everything in Cayenne set to defaults except
> that I'm using the jdbc resource defined in the web.xml in order to
> not have to set usernames and passwords for the various sites
> (desktop,
> Q/A, production).
>
> What I see is:
> 1. Getting the nextval from the sequence yields 45, for example.
> 2. The highest id is 59.
>
> I'm guessing that Cayenne gets a 48 in the above situation, tries to
> insert with a primary key of that value and fails with a duplicate.
>
> I'm looking for ideas to debug, ideas on how likely it is that
> Cayenne and the database have differing takes on what the next
> primary key should be and things like that.
>
> Help!
> arturo
>
>
This archive was generated by hypermail 2.0.0 : Thu Sep 07 2006 - 02:33:28 EDT