Copying a nested data object to another data object destroys the reference on the source object

A data object, Father, contains another data object, Child. Inside a Java snippet, the object containing Child is fetched and set on a substructure of data object, Mother. The reference to Child in data object Father disappears.

Reason

The reference to Child is moved from Father to Mother.

Resolution

When such a data transformation is performed in a Java snippet, copy the data object before it is assigned to another object. The following code snippet illustrates how to do this:
BOCopy copyService = (BOCopy)ServiceManager.INSTANCE.locateService
                      ("com/ibm/websphere/bo/BOCopy"); 
DataObject Child = Father.get("Child"); 
DataObject BCopy = copyService.copy(Child); 
Mother.set("Child", BCopy);

Terms of use | | Broken links

Last updated: Tue Dec 06 04:14:41 2005

(c) Copyright IBM Corporation 2005.
This information center is powered by Eclipse technology (http://www.eclipse.org)