>I've tried to clone an EO in Java, but I'm having no luck.

Don't do it, then. :-)
No, really..

>Essentially I want to do a "deep" clone as the Address class has a Province
>and Country object inside of it (each with their own set of attributes).

While it is definitely possible to 'copy' EOs, you shouldn't try to
do it unless you really know and understand what you're doing;
otherwise you're compromising the integrity of your database and will
only be rewarded with EOF on fire.
Also, 'deep copying' parts of an object graph can become terribly
inefficient, not to mention semantically wrong.

This topic has been discussed in great length before (see the list
archives) but the short explanation is that copying EOs in memory
would create objects that don't correctly correspond to rows in the
database, and also that EOF might get upset because snapshotting and
uniqueing will be circumvented (kind of).

In your case, if you really need two address objects, just create a
new address and have it take the values from the source object.

hope this helps,
Holger

Reply via email to