Re: Newbie Question concerning pk autoincrementing

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Apr 06 2007 - 13:00:40 EDT

  • Next message: Michael Gentry: "Re: Newbie Question concerning pk autoincrementing"

    On Apr 6, 2007, at 12:53 PM, Jens Mayer wrote:

    > I'm using cayenne with oracle 9.2.0.3.0
    > The pk-attributes in my schema are automatically generated by
    > before-insert-triggers, so cayenne doesn't have to bother
    > generating any pk. Due to this, I set the PK Generation Strategy
    > for all DbEntities to "Database-Generated".
    > And here comes the problem: everytime cayenne is doing an insert, a
    > "select pk_xyz.nextval from dual" is fired. What's that ? Did I
    > missunderstood anything ? I expected cayenne to ignore the pk-
    > attributes completely.

    Essentially when Cayenne knows (ok "assumes" is a more proper word)
    that db-generated pk doesn't work, it fires its own PK generator. The
    problem with using a trigger for PK is that there is no way to pass
    back that value to Cayenne via JDBC, hence Cayenne can't
    appropriately handle newly inserted object after commit. This is a
    JDBC limitation, and I am not aware of a workaround for it on the
    Java end.

    Andrus



    This archive was generated by hypermail 2.0.0 : Fri Apr 06 2007 - 13:01:11 EDT