Re: Elementary Question

From: Michael Gentry (mgentr..asslight.net)
Date: Tue Apr 20 2010 - 09:25:24 EDT

  • Next message: Joe Baldwin: "Re: Elementary Question"

    Hi Joe,

    Your wording on #2 and #3 was a little curious to me. I don't know if
    you used Cayenne Modeler to generate your schema or if you are using
    an existing schema. Cayenne (at runtime) doesn't really instruct the
    database (MySQL) to auto-generate keys. Cayenne will nont provide a
    value for "oid" when inserting the record and that essentially
    instructs MySQL to auto-generate a key. You set this up when you
    create your product table, for example. The database needs to know
    that it is responsible for auto-generating the keys -- Cayenne won't
    tell it at runtime (other than leaving the key out on insert).

    Maybe I'm a bit off on what you were asking, but it seems like you are
    expecting Cayenne to tell MySQL to generate the keys when it actually
    works the other way around: MySQL is supposed to know to generate the
    key and Cayenne then asks it for the key it generated.

    mrg

    PS. BTW, your settings are correct to use the auto-generated key
    feature in MySQL, just be sure the table was created to auto-generate
    on your "oid" column.

    On Mon, Apr 19, 2010 at 8:03 PM, Joe Baldwin <jfbaldwi..arthlink.net> wrote:
    > I apologize for this, but I am being forced to verify a configuration that is pretty obvious.
    >
    > Please refer to the attached CM configuration panel for an Entity.
    >
    > 1. The Primary Key "PK Generation Strategy" is set to "Database-Generated".  Please verify that this means that the PK Generation Strategy is Database Generated.
    > 2. The Primary Key "Auto Increment" is set to "oid (INTEGER)".  Please verify that the field being auto-incremented is "oid".
    > 3. Please verify that (with the DBMS set to MySQL) that the two previous parameters instruct MySQL to use its auto_increment feature to create a new "oid" value for inserted records.
    >
    > Thanks
    > Joe
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Apr 20 2010 - 09:26:29 EDT