Re: Creating Compound PKs

From: John Armstrong (siberia..mail.com)
Date: Mon Jun 04 2007 - 03:22:00 EDT

  • Next message: Lachlan Deck: "Re: performing count"

    I see your consideration on the id triple key and completely agree
    with your points. I do have my relationships mapped and its been
    running very smoothly.

    Time to edit the DB. I've been avoiding it so far since I'm working
    with Derby, its been quite nice!

    Thanks for taking the time to answer my newbie questions. Just
    starting into Cayenne and am enjoying it greatly. Its reducing the
    development time on my app substantially.

    John-

    On 6/4/07, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >
    > On Jun 4, 2007, at 9:52 AM, John Armstrong wrote:
    >
    > > I can enforce it unique in the database but I was thinking that
    > > Cayenne may have a more elegant way of managing it without having to
    > > manually apply the database changes after schema creation. To me that
    > > screamed 'New compound PK'.
    >
    > To me it doesn't :-)
    >
    > Seriously, ORM tool (CayenneModeler) doesn't attempt to replace your
    > DB management tools 100%, although it overlaps a lot. You should
    > still use DB facilities as appropriate.
    >
    > > How do you create compound PK's in Cayenne? I'm still using the
    > > Modeller so I may have to edit the XML natively?
    >
    > Go to the attributes tab of the given DbEntity and check the PK
    > checkboxes of those two extra columns.
    >
    > But note that you would need to delete the "id" column then,
    > otherwise the UNIQUE constraint would span all three columns, not
    > just the two you wanted.
    >
    > Also you would need to mark a relationship from ImapServer to the
    > table in question as "To Dep Pk", so that the serverid could be
    > propagated whenever you do myObject.setServer(myServer).
    >
    > Andrus
    >



    This archive was generated by hypermail 2.0.0 : Mon Jun 04 2007 - 03:22:24 EDT