Re: Newbie Question concerning pk autoincrementing

From: Michael Gentry (blacknex..mail.com)
Date: Fri Apr 06 2007 - 13:43:31 EDT

  • Next message: Reid Thompson: "Netbeans and cayenne"

    Also, this isn't a Cayenne-specific problem, either. I'd so most, if not
    all, ORM technologies would have an issue with the DB generating PKs behind
    the scenes without the ORM stack knowing the values that were assigned.

    Thanks,

    /dev/mrg

    On 4/6/07, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >
    >
    > 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:43:58 EDT