It worked everywhere else; the problem I've got is that I'm not interested in marshalling LocationMapper itself - I'm only interested in pushing selected fields out of the Location object.


(Types are missing where they're strings; this schema is only used on an outward push of content, and is never used to load content in.)

It never struck me to write a mapping for the LocationMapper object because it was never being selected directly. We're marshalling the Location object, with it's "LocationDetails.url", but trying to call specific methods on the sub-object.

If I now build a field list for the LocationDetails object, it *still* will not reference the correct methods on the LocationDetails object when called as "LocationDetails.url". When used in a nested attribute query, the classes of the nested attribute do not get mapped via the field mappings, and specifying...

<class name="com.wow.framework.dao.LocationDetails">
<field name="url" get-method="getURL" set-method="setURL">
        <bind-xml name="url"/>
</field>
</class>

doesn't matter, because we're never marshalling LocationDetails, and it never bothers to look for a class/field mapping for nested attributes.

There appears to be no way for me to refer to a specific getter/setter on that object when it's used in a nested attribute; I expected getURL/setURL to apply to the getter/setter needed to be called *on the nested attribute*, and that's not working. That's the example provided.

I'd like to see one of the above behaviors work. :)

The call graph *SHOULD* be getLocationDetails().getURL(); there appears to be no way for me to do that. It *feels* like a bug - but maybe I'm wrong on this.

I had expected - this felt right - that in a nested query, the get- and set-method calls would apply to the *nested* object that I'm trying to get information out of.

If you prefer to think of it as requiring all those nested objects to have class/field mappings that each specify, for each object, hot to traverse those objects, I've got no problem with such in principle, but that isn't working either. It's certainly a more flexible option, and if you can figure out a way to make it work, I'll be duly impressed. :)

All I need to do is include, in a mapping, the contents of a nested attribute where the nested attribute itself does not obey standard bean naming rules; the above example, getURL/setURL, is unreachable in a nested query because there appears to be no way for me to apply a get-method/set-method to the final object in the query.

On 24 Mar 2004, at 22:00, Keith Visco wrote:
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


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




Reply via email to