Re: Primary Keys in Cayenne

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Dec 04 2002 - 10:49:00 EST

  • Next message: Dave Slusher: "Re: Primary Keys in Cayenne"

    Hi Dave,

    Basically, autogeneration (autoincrement) of PKs will be used when all other
    options are exhausted. Options are listed here:

    http://objectstyle.org/cayenne/userguide/design/autopk.html#pk

    and are basically:

    1. Meaningful Primary Key
    2. Primary Key Derived From Realtionship
    3. Automatic

    So to switch a certain key from type (3) to type (1), you can manually add
    an ObjAttribute in ObjEntity that maps to a PK DbAttribute. If such
    ObjAttribute is present, then autogeneration will not occur.

    Andrus

    Dave Slusher writes:

    > Guys,
    >
    > I'm doing some work with Cayenne at my company. Correct me if I'm
    > incorrect about this, but is there any way at the datamap level to specify
    > which keys are autoincrement and which are not? It seems like the handling
    > is global at forward engineering time - either all integral types that are
    > primary keys get autoincrement support or none do. Is there any way to tag
    > or untag which ones are to be autoincremented?
    >
    > My issue is that in our schema, we do have integral types that are keys
    > but not autoincremented. Most are, but several are not. This really
    > complicates using Cayenne in the forward engineering of the schema.
    >
    > d
    >
     



    This archive was generated by hypermail 2.0.0 : Wed Dec 04 2002 - 10:49:04 EST