Re: questions on compound keys

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Apr 02 2003 - 22:59:02 EST

  • Next message: Troy McKinnon: "clobs in cayenne"

    Troy,

    let me answer this one as well.

    1. Mark all relevant columns as primary keys for all DbEntities.
    2. Model all relationships between them
    3. Relationships going from a master table to the join table, e.g.
    TABLE1 -> TABLE3 in your case, must be checked as 'To Dep Pk". This
    tells Cayenne that "master" primary key should be generated (or set
    explicitly), while Dep[endent] PK will be copied from master.
    4. In ObjEntities, don't include PK and FK columns as class attributes
    (ObjAttributes in Cayenne terms), unless you *really* need to do so.

    Andrus

    On Wednesday, April 2, 2003, at 09:53 PM, Troy McKinnon wrote:

    > I was just wondering if some can give me some insight into the best
    > way to
    > insert records into a cross reference table with a compound key which
    > is
    > made up by a foreign key to two different tables? Also, because of the
    > issue
    > with no assigning a parent key (i.e. re: same object duplicated in the
    > result), will a select work with a compound parent key?
    >
    > TABLE 1
    > ------------
    > pk_id
    > val1
    > val2
    >
    > TABLE 2
    > ------------
    > pk_id2
    > another1
    > another2
    >
    > TABLE 3
    > ------------
    > pk_id1
    > pk_id2
    >
    >
    > Troy McKinnon
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Apr 02 2003 - 23:03:39 EST