RE: Specifying PK when creating a new object in DB generated PK mode

From: Scott Anderson (sanderso..irvana.com)
Date: Wed Feb 20 2008 - 13:31:01 EST

  • Next message: Andrus Adamchik: "Re: Specifying PK when creating a new object in DB generated PK mode"

    It looks like there's no model that fits what I'd like to do. IMO, the
    user should be able to specify the PK in DB-generated mode when either
    the field is exposed, or the PK is set through the ObjectID map. Cayenne
    should not disregard user-made decisions: it isn't Cayenne's
    responsibility to enforce PK integrity.

    -----Original Message-----
    From: Aristedes Maniatis [mailto:ar..sh.com.au]
    Sent: Wednesday, February 20, 2008 2:01 AM
    To: use..ayenne.apache.org
    Subject: Re: Specifying PK when creating a new object in DB generated PK
    mode

    On 20/02/2008, at 9:51 AM, Scott Anderson wrote:

    > I am working an a request ticket system, similar to the one I'm using
    > to enter this issue. I need to import requests from the old schema to
    > the new schema, and the PKs must be specified while doing an import.
    > When using the tool normally, the PKs must be database generated. Is
    > there any way to do this?

    You can specify the key yourself easily:
    http://cayenne.apache.org/doc/primary-key-generation.html

    But I can't see how you can guarantee you will not get collisions
    between your two schemes. Maybe better to keep the old key in a separate
    field for reference purposes.

    Ari Maniatis



    This archive was generated by hypermail 2.0.0 : Wed Feb 20 2008 - 13:31:55 EST