Re: Odds and Ends

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Jun 22 2004 - 12:45:17 EDT

  • Next message: Andrus Adamchik: "Re: deleteObject() and removeFrom*List()"

    Hi Elia,

    On Jun 22, 2004, at 11:16 AM, Elia Morling wrote:
    > If I want to add a new table later on, do I simply add a field with the
    > TABLE_NAME and set the NEXT_ID to 200?
    >
    > How does NEXT_ID work?

    Primary key generation mechanism is abstracted in Cayenne. Concrete
    implementations (using a sequence or an AUTO_PK_TABLE with NEXT_ID) are
    done per DbAdapter:
    http://objectstyle.org/cayenne/userguide/design/autopk.html

    If you add more tables to your schema, you can manually insert extra
    rows in AUTO_PK_TABLE (if this is what your DbAdapter is using).
    Unfortunately CayenneModeler doesn't allow you to select which tables
    you care about during "Generate DB Schema" operation. But it can still
    help with PK update.

    Do this: Click on "Generate Database Schema" menu, and in the SQL panel
    uncheck all checkboxes except for "Create Primary Key Support". Then
    you can copy parts of remaining SQL for the relevant tables, and use it
    outside CayenneModeler.

    > Why does it increment by 20?

    "20" is the default primary key cache value used by Cayenne. It is used
    to eliminate extra DB trips to get pk when inserting multiple objects,
    and is controlled by this property:

    http://objectstyle.org/cayenne/api/cayenne/org/objectstyle/cayenne/dba/
    JdbcPkGenerator.html#getPkCacheSize()

    > In the Relationships tab of the Modeler. What is the difference between
    > To Dep PK and To Many?

    To-many is exactly what it says. To Dep PK ("to dependent primary key")
    is something unrelated. Read some more about it here:
    http://objectstyle.org/cayenne/modelerguide/modeling-db-layer/to-dep-
    pk.html

    > The Main.java in cayenne-cmd-app is incomplete. It doesn't tie the
    > painting
    > to a gallery. The following should be added to the addArtist method:
    > gallery.addToPaintingArray(paint);

    Just fixed this in CVS. Good catch...

    > TheServerSide article uses the following:
    > DataContext context = DataContext.createContext();
    > It doesn't work. It should be:
    > DataContext context = DataContext.createDataContext();

    Oops, you are right, that was a typo.

    Andrus



    This archive was generated by hypermail 2.0.0 : Tue Jun 22 2004 - 12:45:23 EDT