oops.  the msg accidentally got sent pre-completion.

i just wanted to say that i've been seeing the behavior
that when an object is marshalled to XML with a reference
that the reference appears correctly.

however, when attempting to unmarshal that exact same XML
String (as well as w/other Readers), the reference is omitted
from the parent object - it is null.

maybe i'm just doing something wrong here.  any tips?

thanks,
chris

Date: Tue, 10 Dec 2002 13:10:23 -0500
To: [EMAIL PROTECTED]
From: Chris Butler <[EMAIL PROTECTED]>
Subject: reference="true", unmarshal problem

has anyone else had a problem with references?

i'm wondering if my assumption should be true...
if i marshall an object to XML with has a reference
in it (only an ID to another object), if i unmarshall
that XML to an object will the child object be created
with only that field filled in?

ie.

public class Parent {
        private Integer id = null;
       private String name = null;
       private Child child = null;

       // setters, getters
}

public class Child {
        private Integer id = null;
       private String name = null;
       private Parent parent = null;

       //  setters, getters
}

    <class name="Parent" identity="id" key-generator="seqgen">
        <map-to xml="parent"/>
        <field name="id" type="java.lang.Integer" >
                <xml name="id" node="attribute"/>
        </field>
        <field name="name" type="java.lang.String">
                <xml name="name" node="element"/>
        </field>
        <field name="child" type="Child">
                <xml name="child" node="element" reference="true"/>
        </field>
    </class>

    <class name="Child" identity="id" auto-complete="true">
        <map-to xml="child"/>
        <field name="id" type="java.lang.Integer" >
                <xml name="id" node="attribute"/>
        </field>
        <field name="name" type="java.lang.String" required="true">
                <xml name="name" node="element"/>
        </field>
        <field name="parent" type="Parent">
                <xml name="parent" node="attribute" reference="true"/>
        </field>

    </class>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.427 / Virus Database: 240 - Release Date: 12/6/2002

Reply via email to