I'm using castor version 1.1. I'll try to add identity attributes to all
class mappings.
Thanks,
Marija
On 5/25/07, Werner Guttmann <[EMAIL PROTECTED]> wrote:
What version of Castor are you using ? And without having looked into
details (yet), I think adding identity="..." attributes to all class
mappings might help.
Werner
Marija Susović wrote:
> Hi!
>
> I have a problem with identity descriptor. My object model is like this:
>
> public abstract class BaseClass{
>
> private Integer id;
> ...
> //getters and setters
> }
>
> public abstract class IntermediaryClass extends BaseClass{
>
> ...
> }
>
> public class AClass extends IntermediaryClass{
>
> private String member1;
> ...
> //getters and setters
> }
>
> public class MainClass{
>
> private AClass root;
> ....
> //getters and setters
> }
>
> Mapping file looks like this:
>
> <mapping>
>
> <class name=""java_package.IntermediaryClass>
> ...
> </class>
>
> <class name="java_package.AClass"
> extends="java_package.IntermediaryClass" identity="id">
> <field name="member-1" type="string"/>
> <field name="id" type="integer"/>
> ...
> </class>
>
> <class name="java_package.MainClass">
> <field name="root" type="java_package.AClass">
> <bind-xml name="root" reference="true"/>
> </field>
> ...
> </class>
>
> </mapping>
>
> When I try to marshal this model, I get this error:
> Unable to resolve ID for instance of class
> '
hr.combis.rule.editor.DT.utils.ArithmeticTreeImpl$ArithmeticTreeConnectorNode
'
> due to the following error: No identity descriptor available
> at org.exolab.castor.xml.Marshaller.getObjectID(Marshaller.java
:2018)
> at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1657)
> at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1861)
> at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1861)
> at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1861)
> at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1855)
> at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:840)
> at
> hr.combis.rule.editor.mapping.impl.XMLMappingImpl.marshalRuleModel(
XMLMappingImpl.java:105)
> ... 66 more
>
> Here is ArithmeticTreeImpl$ArithmeticTreeConnectorNode equal to AClass.
>
> I tried to debug and found out that the Castor's method
> XMLClassDescriptorImpl.setIdentity(fieldDesc) is never invoked with
> fieldDesc=id when XMLClassDescriptorImpl is class descriptor for
> ArithmeticTreeImpl$ArithmeticTreeConnectorNode. Identities are set only
> for direct subclasses of BaseClass. (BaseClass has few direct concrete
> subclasses, they are not specified above.)
> Is this a bug or i'm missing something?
> Thanks,
>
> Marija
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email