Re: Primary Keys in Cayenne

From: Andrus (andru..bjectstyle.org)
Date: Wed Dec 04 2002 - 21:16:21 EST

  • Next message: Andrus: "Re: Intermittent RequestQueue problem"

    At 03:05 PM 12/4/2002 -0500, Dave Slusher wrote:
    >I'm not sure if I mentioned, but the issues I am seeing are with forward
    >engineering of the DB from datamap to an Oracle database. I looked through
    >the code and couldn't see anywhere at creation time for triggering whether
    >PK support is needed for this table or not (ie, don't create the sequences
    >if not needed.)

    Ok, I didn't realize that you are seeing this during DB generation (as
    opposed to working with inserted objects). You are right - there is no
    distinguishing between auto PK tables and all other tables at this stage.
    IIRC better implementation was postponed to save time, since creating an
    extra unused DB schema object (like a sequence) looked like a minor
    inconsistency rather then a serious issue.

    Now we are tying the loose ends, so the time may have come. I guess I will
    file this as a bug. Suggested fix would be

    1. To do it smart by default - if a key is propagated or has an
    ObjAttribute, don't generate PK.

    2. To alter this, implement a delegate to DbGenerator that will be
    consulted about the desired behavior. Create a delegate implementation in
    the modeler to allow user to check/uncheck settings at the individual
    entity level.

    BTW, was it you who submitted bug 644200 about OutOfMemory error on reverse
    engineering?

    >We're beginning at the shallow end of the pool by using a Cayenne driven
    >Java application to do our database provisioning on either mysql or
    >Oracle. I subclassed the OracleAdapter and OraclePkGenerator to tweak what
    >gets done at DbGenerate time (I wanted pre-insert triggers to go along
    >with the auto-generated sequences) and now I'm just trying to perfect it.

    I see, this is pretty cool. I think in the future we may allow customizing
    the adapter settings, so that such things could be included in the base
    DB-specific adapter.

    Andrus



    This archive was generated by hypermail 2.0.0 : Wed Dec 04 2002 - 21:15:44 EST