Jeremy-
The easiest way to do this is to define an identity field for each
class (this is done in the mapping file by the identity attribute of
the class element -- it is just the name of a field in the java class
that is unique to each object of that class), and then defining that
the XML should reference earlier created classes via the reference
attribute of the bind-xml element. The mapping file would end up
looking something like this (obviously a lot is left out, but
hopefully you get the idea):
<mapping>
<class name="Foo" identity="intID" />
<class name="Bar">
<field name="fooList" type="Foo" collection="ArrayList">
<bind-xml name="foo-item" reference="true" />
</field>
</class
</mapping>
With this mapping file, if (for some reason) the same Foo object
showed up in the list twice, the second occurrence would simply be
<foo-item refid="xxx" />.
HTH,
Stephen
On 3/4/06, Jeremy E. Denton <[EMAIL PROTECTED]> wrote:
>
>
> Is there any way I can unmarshall a document where I can reference an
> object already created? (basically a relational reference)
>
>
>
> <doc>
> <myFirstObject id="someValue">
> <subObject id="a" name="cat"/>
> <subObject id="b" name="dog"/>
> <subObject id="c" name="horse"/>
> </myFirstObject>
> <myOtherObject>
> <referingObject id="a"/>
> </myOtherObject>
> </doc>
>
>
>
> I want that reflect in my object structure that the second object
> points to the first sub object?
>
> Is this possible?
>
> Cheers,
> Jeremy
>
> -------------------------------------------------
> If you wish to unsubscribe from this list, please
> send an empty message to the following address:
>
> [EMAIL PROTECTED]
> -------------------------------------------------
>
>