By the way, I am using 0.9.5.3 rc2.
On Wed, 03 Mar 2004 15:11:32 -0500, "Jeremy Haile" <[EMAIL PROTECTED]>
said:
> I have several collections that are only saving the first element in a
> set. My field type is a java.util.Set. When castor parses the XML file,
> it only calls the setXXX() method one time (as it should), but passes in
> a java.util.Set that contains only one element. Why would castor not be
> processing the whole collection before calling setXXXX?????
>
>
> The mapping for one of the classes I'm having a problem with this with
> follows:
>
> <class name="ex.Organization"
> access="shared"
> auto-complete="false">
>
> <field name="name"
> type="java.lang.String"
> get-method="getName"
> set-method="setName">
> <bind-xml
> node="attribute" />
> </field>
>
> <field name="taxId"
> type="java.lang.String"
> get-method="getTaxId"
> set-method="setTaxId">
> <bind-xml
> node="attribute" />
> </field>
>
> <field name="emailAddresses"
> type="ex.EmailAddress"
> get-method="getEmailAddresses"
> set-method="setEmailAddresses"
> collection="set">
> <bind-xml name="email-address"
> node="element" />
> </field>
>
> <field name="phoneNumbers"
> type="ex.PhoneNumber"
> get-method="getPhoneNumbers"
> set-method="setPhoneNumbers"
> collection="set">
> <bind-xml name="phone-number"
> node="element" />
> </field>
>
> <field name="postalAddresses"
> type="ex.PostalAddress"
> get-method="getPostalAddresses"
> set-method="setPostalAddresses"
> collection="set">
> <bind-xml name="postal-address"
> node="element" />
> </field>
>
> </class>
>
>
> The debug output from Castor is below. You can see where my
> setPhoneNumbers( Set phoneNumbers ) method is called. I print out the
> size of the set being passed in as a parameter. You can also see Castor
> parse another phone number immediately after, but not call the set
> method.
>
> [configurator]
> [configurator] #startElement: organization
> [configurator] #characters:
>
> [configurator]
> [configurator] #startElement: email-address
> [configurator] #endElement: email-address
> [configurator] #characters:
>
> [configurator]
> [configurator] #startElement: phone-number
> [configurator] #endElement: phone-number
> [configurator] 14:58:44,181 DEBUG [Organization] Setting 1 phone
> numbers(s) into party.
> [configurator] #characters:
>
> [configurator]
> [configurator] #startElement: phone-number
> [configurator] #endElement: phone-number
> [configurator] #characters:
>
> [configurator]
> [configurator] #startElement: postal-address
> [configurator] #endElement: postal-address
> [configurator] #characters:
>
> [configurator]
> [configurator] #endElement: organization
> [configurator] #characters:
>
>
> Just in case you are curious, the setter method with the debug call looks
> like:
>
> public void setPhoneNumbers(Set phoneNumbers) {
> logger.debug( "Setting " + phoneNumbers.size() + " phone
> numbers(s) into party." );
> this.phoneNumbers = phoneNumbers;
> }
> --
> Jeremy Haile
> [EMAIL PROTECTED]
--
Jeremy Haile
[EMAIL PROTECTED]
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev