Hello,
I have a problem with newer versions of Castor. Castor 1.0.5 is the last
version, in which it works correctly.
This error message is raised while serializing objects to XML :
"The following exception occured while validating field: B of class: A: The
object associated with IDREF "[EMAIL PROTECTED]" of type class A has no ID!"
This is very simply described object model:
public class A {
....
private B b;
....
}
public class B {
....
private A a;
....
}
this is castor mapping for these objects:
<class name="A" auto-complete="true" identity="uniqueId">
<map-to xml="A"/>
<field name="uniqueId">
<bind-xml name="uid" node="attribute"/>
</field>
<field name="B" type="B">
<bind-xml name="B" node="element"/>
</field>
</class>
<class name="B" auto-complete="true" identity="uniqueId">
<map-to xml="B"/>
<field name="uniqueId">
<bind-xml name="uid" node="attribute"/>
</field>
<field name="A" type="A">
<bind-xml name="ARef" node="attribute" reference="true"/>
</field>
</class>
correct XML produced by Castor 1.0.5 looks like this:
<A uid="A1">
<B uid="B1" ARef="A1">
</B>
</A>
If I understand it right, validation goes recursive from A to B. And it
seems, that ID of object A is not yet resolved when object B is validated.
Am I making something wrong or is it a bug in Castor? Is there any solution
or workaround?
Best Regards
Marek Lapak
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email