Re: The right way to populate meaningful keys

From: Juergen Saar (juerge..saar.org)
Date: Thu Jul 30 2009 - 10:53:27 EDT

  • Next message: Michael Gentry: "Re: The right way to populate meaningful keys"

    This was my way ...
    But I ran in deep trouble with the ObjectId ... this seems not to be
    sycronized

    My actual CayenneRuntimeException:
    Can't extract a master key. Missing key (esd_abteil), master ID
    (<ObjectId:EsSend, TEMP:0000021E6A770001>)

    It belongs to a 1:1 Relation and the PK-Values in source and target are
    correctly set.
    The Commit is interrupted and the Relation-Data are not inserted to DB.

    In nearly all cases ... even when all data is inserted in DB the following
    CayenneRuntimException is thrown:
    Temporary ID hasn't been replaced on commit:{<ObjectId:EsSend,
    TEMP:0000022273C50001>; new; ...}

    Any idea?
    -Juergen-

    PS: I'm using the Version 2.0.4

    2009/7/30 Michael Gentry <mgentr..asslight.net>

    > Cayenne, by default, doesn't map keys from the DbEntity (database
    > definition) to the ObjEntity (Java definition), but you can go into
    > the ObjEntity and add them and it should be fine. After you do that,
    > just call the set/get methods for the keys to set/get them. If you
    > set a key on a new object before you commitChanges(), Cayenne will use
    > your key instead of trying to generate one.
    >
    > mrg
    >
    >
    > On Thu, Jul 30, 2009 at 1:24 AM, Juergen Saar<juerge..saar.org> wrote:
    > > Hi all,
    > >
    > > I'm using cayenne within an old 4GL-Project with meaningful Primary Keys.
    > >
    > > Is there a 'best practice' to get this keys into the DataObject-Instance?
    > >
    > > Actually I've various trouble with this ...
    > >
    > >
    > > Any hint or code-sniplet would be helpful ...
    > > -Juergen-
    > >
    >



    This archive was generated by hypermail 2.0.0 : Thu Jul 30 2009 - 10:54:06 EDT