Re: Duplicate CayenneDataObject

From: Jürgen Saar (jsaa..eb.de)
Date: Sat Jul 31 2004 - 08:52:55 EDT

  • Next message: Elia Morling: "SQL Escape Characters"

    Hi,

    for such enhancements, I always use my own class,
    which has CayenneDataObject als parent.

    Then you can implement the interface clonable
    with the clone() method. Perhaps Andrus has
    an idea to enhance the CayenneDataObject.

    --- Jürgen ---

    Mike Kienenberger <mkienen..laska.net> schrieb am 31.07.04 14:01:47:
    >
    > Elia Morling <eli..amiljen.se> wrote:
    > > > Wouldn't such a method create numerous problems with deep and/or shallow
    > > > copies, and duplication of relationships?
    > >
    > > Yes if it has a to-many relationship, but there are plenty of leaves at
    > the bottom
    > > of the tree using only parents. Which in many cases will be created and
    > duplicated
    > > often.
    > >
    > > 1. Validate object to make sure it doesn't have a to-many relationship
    > > 2. CreateAndRegisterNewObject with the class of the source object
    > > 3. For each property in source object writeProperty() in new object
    > > 4. Pass along any exceptions
    >
    > Sounds like you have it all figured out.
    >
    > It's probably worth submitting your solution as an enhancement (maybe as a
    > method on DataContext) as it's been requested before. I use a similar
    > solution in a WebObjects project that has not yet been ported to Cayenne.
    >
    > An even more comprehensive solution would allow you to
    > duplicateAndRegisterNewObjectCollection(Collection ofDataObjects). Any
    > relationships that exist only between objects in the collection would be
    > created among the new objects.
    >
    > -Mike

    _______________________________________________________
    WEB.DE Video-Mail - Sagen Sie mehr mit bewegten Bildern
    Informationen unter: http://freemail.web.de/?mc=021199



    This archive was generated by hypermail 2.0.0 : Sat Jul 31 2004 - 08:53:04 EDT