Postgres auto sequences

From: Lindsay Steele (lsteel..inet.net.au)
Date: Thu Jan 05 2006 - 07:55:02 EST

  • Next message: Andrus Adamchik: "Re: Postgres auto sequences"

    Has anyone successfully used any sort of data generated sequences in
    Postgresql ? (8.1.1)

    I am running into a problem, if I set the PK Generation strategy to
    default, then it seems to want to look for an auto generated PK table,
    which I am not using. If I can get away with it, I would prefer not to
    use auto PK support.

    If I set the modeler to "Database Generated", then it does the same
    thing. It tries to look for an auto generated PK Table.

    If I used the custom sequence and point it at the sequences that
    Postgres uses internally, then it will do the first insert but Postgres
    will not update it's sequence number. My testing and information from
    Postgres users tells me that the problem here is that cayenne is trying
    to do an insert by specifying the PK. This somehow bypasses Postgres
    updating it's sequence number internally. This continues to work for a
    while as cayenne must keep track of what the last insert was internally
    - but as soon as you restart the app server, information is lost and
    subsequent inserts fail. When you do an insert without specifying a
    primary key the internal number is updated and things work as they should.

    This problem is the same in both Windows and Linux. I am using the
    modeler from M9 and have tried both the cayenne.jar from M8 and M9.

    Does anyone have this working, and if so how ?



    This archive was generated by hypermail 2.0.0 : Thu Jan 05 2006 - 07:55:25 EST