interactions with PostgreSQL sequences

From: Arturo Pérez (apere..ayesinc.com)
Date: Wed Sep 06 2006 - 18:46:53 EDT

  • Next message: Malcolm Edgar: "[annou] Click Framework 1.0 RC2 is now available"

    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 : Wed Sep 06 2006 - 18:47:31 EDT