Gregory,

Castor will look for the getter+setter on whatever class you are
mapping. If <field> is being specified in the <class> mapping for the
Location class, then Castor will look at the Location class. I don't see
anywhere in your example where you are providing a mapping for
LocationMapping, or a <field> mapping within the Location class for the
LocationMapping field.

Looking at your example, I can't automatically figure out what exactly
you're trying to do, but it seems to me that you are missing some
mappings, at least in terms of the LocationMapping class and any fields
of that type.

Also your mapping file appears to be missing the "type" attribute for
all your <field> mappings.


--Keith


Gregory Block wrote:
> 
> Okay, third time's the charm.  I've changed the lingo to more
> accurately model the language in the docs, in the hopes of actually
> getting someone to read this.  :)
> 
> Does anyone have a way to do this?
> 
> I'm looking to do nested attributes, where the object is accessed as...
> 
> class Location {
>         getLocationMapping()
>         setLocationMapping(LocationMapping lm)
> }
> 
> class LocationMapping {
>         getURL()
>         setURL(String urlToSet)
> }
> 
> with a mapping that does...
> 
> <field name="LocationDetails.url" get-method="getURL"
> set-method="setURL">
>         <bind-xml name="url"/>
> </field>
> 
> ... won't work, because it's looking for getURL and setURL on the wrong
> object; even though I've specified the nested attribute.  It insists on
> looking for getURL and setURL on Location, not LocationMapping.
> 
> Is this a bug, a misfeature, or am I not doing something correctly?
> Nothing clear in the documentation on how it should behave, or whether
> it should or should not work.
> 
> >
> > On 18 Mar 2004, at 16:52, Gregory Block wrote:
> >
> >>
> >> I'd like to create a mapping that does something like the following...
> >>
> >>
> >> <class name="com.wow.framework.dao.Location">
> >>                 <field name="id" type="integer" get-method="getID"
> >> set-method="setID">
> >>                         <bind-xml name="id" node="attribute"
> >> type="location-id-type"/>
> >>                 </field>
> >>                 <field name="name" type="string">
> >>                         <bind-xml name="name" />
> >>                 </field>
> >>                 <!-- No alternate names yet. -->
> >>                 <field name="parent"
> >> type="com.wow.framework.dao.Location">
> >>                         <bind-xml name="parent-location"
> >> type="wow-types:location-type"/>
> >>                 </field>
> >>                 <field name="LocationDetails.displayAddress">
> >>                         <bind-xml name="address"/>
> >>                 </field>
> >>                 <field name="LocationDetails.url" get-method="getURL"
> >> set-method="setURL">
> >>                         <bind-xml name="url"/>
> >>                 </field>
> >>                 <field name="LocationDetails.phone">
> >>                         <bind-xml name="tel"/>
> >>                 </field>
> >>                 <field name="LocationDetails.fax">
> >>                         <bind-xml name="fax"/>
> >>                 </field>
> >>                 <field name="LocationDetails.email">
> >>                         <bind-xml name="email"/>
> >>                 </field>
> >>      </class>
> >>
> >> Now, I appear to get the correct behavior for phone, fax, and e-mail
> >> - those fields aren't, at least, reporting any grave errors.
> >> However, LocationDetails.url isn't reachable; no matter what I do, it
> >> insists on looking in the Location object for the getURL() and
> >> setURL() calls.
> >>
> >> Anyone have any idea how I can convince it to look at the nested
> >> attribute?
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

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

Reply via email to