Sorry about the long winded email...
I am seeing strange behavior with castor 0.9.5/0.9.4 container attribute:
I have an employee test class which contains a collection (arraylist) of
addresses:

here is the mapping snippet
<mapping>
    <class name="org.o2xmapper.test.Employee" auto-complete="false">
        <description>Default mapping for class
org.o2xmapper.test.Employee</description>
        <map-to xml="employee"/>
..
        <field name="addressList" type="org.o2xmapper.test.Address"
            required="false" direct="false" transient="false"
container="false" collection="collection">
            <bind-xml name="address-list" node="element"/>
        </field>
    </class>
 <class name="org.o2xmapper.test.Address" auto-complete="false">
        <description>Default mapping for class
org.o2xmapper.test.Address</description>
        <map-to xml="address"/>
        <field name="address3" type="string" required="false"
            direct="false" transient="false">
            <bind-xml name="address3" node="element"/>
        </field>
...
Setting container attribute to "false" gives me the following result
<address-list>
        <address>
                <address2>Chicago</address2>
                <address1>1 n franklin</address1>
                <state>il</state>
        </address>
        <address>
                <address2>chicago</address2>
                <address1>320 w ohio</address1>
                <state>ILLINOIS</state>
        </address>
</address-list>

Now when I set the address list fields container attribute to "true", I get
the following output for address:
<address2>Chicago</address2>
<address1>1 n franklin</address1>
<state>il</state>
<address2>chicago</address2>
<address1>320 w ohio</address1>
<state>ILLINOIS</state>
and so on...

I notice that not only the 'address-list' element is gone, but also the
'address' element

Finally I remove the container attribute completely from the mapping and
here's my result:

<address-list>
        <address2>Chicago</address2>
        <address1>1 n franklin</address1>
        <state>il</state>
</address-list>
<address-list>
        <address2>chicago</address2>
        <address1>320 w ohio</address1>
        <state>ILLINOIS</state>
</address-list>

So I get 3 different behaviors for a boolean attribute
Just for fun I tried castor 0.9.4 and the  results are similar.

Is this behavior as designed? If so why ignore the address class level
mapping if container=true.

btw, the location feature is very cool, its already the dev. teams at my
company some serious time.

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to