Hello all,
I am looking at how to preserve object identity when going from Java
objects to XML then back again. E.g. if two 'child' classes each
have references to a single instance of a 'parent' class:
Parent parent = new Parent();
Child child1 = new Child();
child1.setParent(parent);
Child child2 = new Child();
child2.setParent(parent);
When I marshal this to XML then unmarshall to Java, a new instance of
Parent is created for each child:
child1.getParent() != child2.getParent()
I have had a look through the doc's, and the relevant attribute in
the mapping file seems to be 'identity' in the 'class' element, but I
am struggling to find out how / if this works in terms of Castor's
XML variant.
I tried adding a String field 'id' to Parent with appropriate getId /
setId and the following to the mapping file:
<class name="Parent" identity="id"/>
But had no joy with this. Can anyone point to any doc's or shed any
light?
Thanks in advance.
Howard
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------