users@jaxb.java.net

Re: JAXB Unmarshalling and XmlIDREF using different stores

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Thu, 29 Nov 2007 22:24:42 +0100

Hi.

> We're using JAXB 2.1 to marshal/unmarshal Java objects to an XML
> database and to different files. Some objects contain XmlIDREFs to
> objects stored in another file. On unmarshalling one of these objects
> the referencing attribute is set to "null" because JAXB cannot resolve
> the reference. Is there a way around this? We store IDs and fill the
> referenced objects manually as an ugly workaround. Do all the elements
> referencing each other have to be in the same document for JAXB to
> work? There does not seem to be a callback mechanism to resolve the
> references on misses.
>
> Does the non-goal "traversal of JavaBean object graphs" mean this will not work?

You'll just need to provide a custom id resolver.

http://weblogs.java.net/blog/kohsuke/archive/2005/08/pluggable_ididr.html

Bye.
/lexi