Re: DB2 Sequence Problem

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Aug 28 2003 - 08:52:44 EDT

  • Next message: Andrus Adamchik: "Re: cayenne and object caching"

    Hi Mario,

    How is the S_ARTIST sequence defined in the database? By default
    Cayenne would assume increment of 20 and use this value for caching the
    primary key. Values other than 20 are customizable in the Modeler per
    DbEntity. Unfortunately this customization is currently used by Oracle
    adapter only. It shouldn't be too hard to patch DB2 adapter as well.

    Andrus

    On Thursday, August 28, 2003, at 04:08 AM, Mario Linke wrote:

    > Hi,
    >
    > I make in Java:
    >
    > Artist art1 = (Artist) ctxt.createAndRegisterNewObject("Artist");
    > art1.set...
    > ctxt.commitChanges(Level.WARN);
    >
    > Artist art2 = (Artist) ctxt.createAndRegisterNewObject("Artist");
    > art2.set...
    > ctxt.commitChanges(Level.WARN);
    >
    > and the outtput is:
    >
    > WARN QueryLogger: --- will run 1 query
    > WARN QueryLogger: INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME,
    > DATE_OF_BIRTH) VALUES (?,?,?)
    > WARN QueryLogger: [bind: 55 'Artist_1', '1970-01-01']
    > WARN QueryLogger: +++ transaction committed
    >
    > WARN QueryLogger: --- will run 1 query
    > WARN QueryLogger: INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME,
    > DATE_OF_BIRTH) VALUSE (?,?,?)
    > WARN QueryLogger: [bind 56, 'Artist_2', '1970-01-01']
    > WARN QueryLogger: +++ transaction commited
    >
    > th problem:
    >
    > the query: SELECT NEXTVAL FOR S_ARTIST FROM SYSIBM.SYSDUMMY1
    > is ONCE execute
    > -> the database sequence is 55 and not 56, how in the example by the
    > art2
    > generated.
    >
    > By the next insert i become a error.
    >
    > Is this a cache problem?
    >
    > Mario.
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Aug 28 2003 - 08:42:03 EDT