Hi David,

> David Nemeshazy wrote:
> 
> Hi Keith,
> 
> Thanks for the prompt feedback!
> I have tried your solution, but it still does not work. I only get the
> first element in the collection, because it seems that the
> convertUponSet is called only once.

My convertUponGet was returning an array instead of an arraylist so it
was working for me since the setter is always called again with arrays.

> 
> You were mentionning this in your first answer ("make sure the set
> method is called instead of assuming an actual reference to the
> collection is being passed back from the get"), did you change it in
> your code when you did your tests?

By returning an array it was forcing the set to be recalled.

> 
> Because in the documentation it is stated that convertUponGet should
> only be used during marshalling and convertUponSet during
> unmarshalling, but it does not seem to be the case with collections.

True. I've found out the problem, it comes from a hack that allows JDO
to think user specified handlers are actually FieldHandlerImpl. 

In MappingLoader you will see the following:

667:            //-- Fix for Castor JDO from Steve Vaughan, Castor JDO
668:            //-- requires FieldHandlerImpl or a ClassCastException
669:            //-- will be thrown...
670:            handler = new FieldHandlerImpl(handler, typeInfo);
671:            //-- End Castor JDO fix

It's this fix which is causing the converUponGet to be called again each
time because that handler will use the given typeInfo and specify it's
own CollectionHandler.

I'll try to get that cleaned up.

--Keith

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

Reply via email to