Eric,
Cayenne 1.2 has some unadvertised object graph cloning facilities
centered around ClassDescriptor interface (that has a 'shallowMerge'
method). I've written a few specialized operations, such as
DeepMergeOperation and ObjectDetachOperation in Util package that are
doing smart deep copy for some internal use.
Could you explain a bit what is the purpose of the copy operation and
whether the original and cloned objects are (or should be) registered
with a DataContext and whether this is the same DataContext for the
original and the clone.
Andrus
On May 31, 2006, at 1:03 PM, Eric Lazarus wrote:
> What are the best ways to copy an object that is
> persisted by Cayenne? I'm an old-time smalltalk
> programmer and like to write a copy and a postCopy
> method where a shallowCopy method is called before
> the postCopy method is called and shallowCopy just
> calls clone.
>
> Are there any tricks to do take into account when
> doing a copy of a subclass of a cayenne DataObject?
>
> Does the clone method perform a shallowCopy and give
> me back something that will persist correctly? Do I
> need to do something so that the clone will be known
> to cayenne? Perhaps clone is not supported at all in
> cayenne?
>
> I see a mention of SnapShot but I dont know what that
> is. I also see cloneViaSerialization but perhaps that
> is just for use with internal data structures and not
> my domain objects?
>
> Thanks,
>
> Eric
This archive was generated by hypermail 2.0.0 : Thu Jun 01 2006 - 11:46:41 EDT