Re: Clone an Object and Create New PK

From: Mike Kienenberger (mkienen..laska.net)
Date: Thu Mar 25 2004 - 14:16:23 EST

  • Next message: Andriy Shapochka: "Re: Clone an Object and Create New PK"

    Bret Gregory <bret.gregor..ccesspointinc.com> wrote:
    > I am still doing a deep copy of the object, but now it is just a matter of
    > looping over the relationships and basically doing the same logic in order
    > to copy the data from the old to the new.

    Well, you can do that, but it means you may end up with multiple copies of
    the same object.
    It depends on your schema.

    > I basically, just mimic'd the
    > writeProperty by forcing the peristance state on the object to new. I am
    > not sure why I had to do this since I had just created and registered the
    > new object above this block of code. After creating the new object but
    > before I commit, I am setting different properties. These seem to be
    > ignored, unless the new object's persistance state is changed.

    No idea. Maybe Andrus will tell us :) My recommendation is still to
    duplicate writeProperty rather than just set the state to NEW since there
    may be other hidden gotchas.



    This archive was generated by hypermail 2.0.0 : Thu Mar 25 2004 - 14:16:00 EST