Re: Primary Keys in Cayenne

From: Dave Slusher (dslushe..uarded.net)
Date: Wed Dec 04 2002 - 15:05:23 EST

  • Next message: Craig Miskell: "Intermittent RequestQueue problem"

    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.)

    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. At this
    moment, that's all we're using Cayenne for, but this is the thin edge of
    the wedge and with any luck will actually use it in middleware someday.

    d

    At 06:06 PM 12/4/2002 +0000, you wrote:
    >Dave Slusher writes:
    >><obj-attribute name="id" type="java.lang.Integer" db-attribute-name="id"/>
    >>This is what you were saying, right? If there exists an ObjAttribute
    >>mapped to the DbAttribute, it shouldn't generate the support. However,
    >>after adding in that line I'm not seeing an effect. I get the identical
    >>SQL out of it before and after adding that line. Is there more I need to
    >>do in the data map to suppress this?
    >
    >Hmm, yes. This is what I meant. I guess you will also need to make "id"
    >your class property and explicitly assign a value to the Java object
    >before commit:
    >obj.setId(12345);
    >Let me know if this works. We should create a bug if it doesn't.
    >This kind of reminds me that we don't have tests for this case. I will add
    >them soon just to be sure that it works as advertised.
    >
    >>Thanks for the help. Cayenne really rocks, shortening an odious cross-db
    >>support issue we have by days if not weeks. Kick ass!
    >
    >Cool! I didn't know Guarded used Java, I thought you guys were a C(++) shop.
    >Andrus



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