RE: Copy a DataObject

From: Gentry, Michael \(Contractor\) ("Gentry,)
Date: Thu Dec 30 2004 - 10:52:47 EST

  • Next message: Mike Kienenberger: "Re: Cayenne for SIM-like game"

    I would think Cloneable wouldn't be what you wanted, either. They are equivalent objects, but not identical objects (key is different).

    There is also the issue of relationships. Do you want to copy the original object and the relationships (a deep copy) or just copy the keys to them (a shallow copy).

    /dev/mrg

    -----Original Message-----
    From: Cris Daniluk [mailto:cris.danilu..laraview.com]
    Sent: Tuesday, December 28, 2004 5:55 PM
    To: cayenne-use..bjectstyle.org
    Subject: RE: Copy a DataObject

    The cloneable contract requires that the resultant object is equal to the
    base object (and thus that the hashCodes are equal as well). This could lead
    to a lot of awkward situations considering Cayenne's design, so Cloneable
    probably would not work.

    > -----Original Message-----
    > From: Jürgen Saar [mailto:jsaa..eb.de]
    > Sent: Tuesday, December 28, 2004 11:11 AM
    > To: cayenne-use..bjectstyle.org
    > Subject: Re: Copy a DataObject
    >
    > I would prefer to implement cloneable
    > and then go on like Mike
    >
    > Mike Kienenberger <mkienen..laska.net> schrieb am 28.12.04 16:28:40:
    > >
    > > Dave <sanxion200..ahoo.com> wrote:
    > > > Are there any built in methods to create a copy of a
    > DataObject? I
    > > > want to add a new row that is the same as a prior. The
    > key would be
    > > > the only difference.
    > >
    > > I think you could do it by iterating through the "values" protected
    > > DataObject map.
    > >
    > > Create a new object.
    > > Iterate through values.
    > > value = readProperty(key)
    > > writeProperty(key, values)
    > >
    > > You might find that readPropertyDirectly and writePropertyDirectly
    > > will work better for you.
    > >
    > > Supporting something like this in DataObjectUtils would be
    > useful, so
    > > you could submit an enhancement request (and probably a
    > patch) in the
    > > Jira issue tracker to get it into a future version of Cayenne.
    > >
    > > -Mike
    >
    >
    > ________________________________________________________________
    > Verschicken Sie romantische, coole und witzige Bilder per SMS!
    > Jetzt neu bei WEB.DE FreeMail: http://freemail.web.de/?mc=021193
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Dec 30 2004 - 10:52:54 EST