Bruce,

The question of why Castor XML cannot find the mutator when no "set-method"
is in the mapping file might be a question for Arnaud and/or Keith.
However, if you're fielding Castor JDO questions, then perhaps the question
of why it can't find the mutator when it _is_ defined by "set-method"
belongs to you.

What I don't understand is if both XML and JDO are using the mapping and
persist package classes, why should they behave differently with respect to
finding the mutator method.

I did some debugging and found that while the FieldMolder$ReflectService for
the collection field has an _addMethod (but no _setMethod), the FieldMolder
itself has _addable set to false.  When CollectionProxy$ColProxy.close() is
called, it finds the FieldMolder not addable and calls setValue() for which
there is none.

I copied lines 592-593 of FieldMolder.java, which set _addable if there is
an add method, to line 650.  This fixed the error.

-doug

B.T.W.  This was with the 0.9.3.19 release.


-doug

-----Original Message-----
From: Bruce Snyder
To: [EMAIL PROTECTED]
Sent: 6/5/2002 3:37 PM
Subject: Re: [castor-dev] JDO create() collection set-method not found

This one time, at band camp, Kvidera, Douglas said:

KD>In case I didn't make it clear, after adding the addB() calls, the
code runs
KD>without error.
KD>
KD>Castor seems to have a bug in that for a collection="collection"
field, I
KD>can either:
KD>
KD>1. Define "set-method" so that the Unmarshaller.unmarshal() will use
it
KD>instead of trying to add the collection as a whole, but then
Database.load()
KD>can't find the "set-method".
KD>
KD>or
KD>
KD>2. Not define "set-method" and Database.load() uses the
KD>"add[CapitalizedFieldName]" method, but Unmarshaller.unmarshal()
can't find
KD>the method and tries to add the collection as a whole.
KD>
KD>My current workaround uses subclasses of HashMap and
AbstractCollection that
KD>obtain the key value by reflection and override add() to use put()
with the
KD>key value instead.  I'd much rather be able to have Castor use the
KD>"set-method" for both unmarshal() and load().

I figured that Castor JDO would be able to find the mutator, but I
don't know about how Castor XML works. I've used the functionality
from Castor XML but I'm not familiar with it's internals. This
question would be better if aimed at Arnaud and/or Keith.


Bruce
--

perl -e 'print
unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

----------------------------------------------------------- 
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