Re: Thanks and PK questions

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Jul 15 2004 - 17:16:11 EDT

  • Next message: Eric Schneider: "Re: Simple retrieval of an object by PK"

    Hi Roy,

    On Jul 15, 2004, at 12:39 PM, McBrayer, Roy wrote:
    > I have a question about primary keys in Cayenne. For tables, that do
    > not
    > have a primary key in the actual database, it appears that Cayenne
    > requires
    > me to designate a primary key.

    Yes, as this is the basis of the ObjectId used to map an object to a DB
    row.

    > If a designate multiple fields as a primary key, does Cayenne use this
    > as a combined key.

    Yes.

    > Also, can I create a primary key that is unrelated to the database and
    > is just tracked internally by
    > Cayenne?

    No, as it breaks the ORM layer (see my first answer), so it must be a
    combination of persistent fields. Just identify a combination of
    columns that provide a unique identifier for the row in the DB. If it
    is not possible with your database there are a few techniques that can
    help, but it is hard to recommend anything without looking at your
    schema and your requirements.

    Andrus



    This archive was generated by hypermail 2.0.0 : Thu Jul 15 2004 - 17:16:15 EDT