Jörg Schaible wrote:
> Hi Michael,
>
> Michael Teixeira wrote:
>
>> Jorg, Jaime,
>>
>> Thanks for your time, thanks for your responses.
>>
>> I did try also registering JavaBeanConverter. The result was unexpected;
>> String properties weren't serialized. Just Strings were omitted, the
>> other types, boolean, Boolean, user defined types, were serialized as
>> usual.
>>
>> I compared the serialization from 1.3.1 to 1.4.2, the diff shows:
>>
>> 4c4
>> < <abbrev>ABG</abbrev>
>> ---
>>> <abbrev/>
>>
>> where 'abbrev' is a String property; the data hasn't changed. And so on,
>> there are many String properties, in many objects, as far as I can tell
>> none are serialized as they were previously.
>>
>> I tried configuring XStream in various ways, the simplest is as follows:
>>
>> xstream = new XStream() {
>> protected MapperWrapper wrapMapper(final MapperWrapper next)
>> {
>> return new HibernateMapper(next);
>> }
>> };
>> xstream.registerConverter(new
>> JavaBeanConverter(xstream.getMapper()));
>> xstream.registerConverter(new HibernateProxyConverter());
>> xstream.registerConverter(new
>> HibernatePersistentCollectionConverter(xstream.getMapper()));
>> xstream.registerConverter(new
>> HibernatePersistentMapConverter(xstream.getMapper()));
>> xstream.registerConverter(new
>> HibernatePersistentSortedMapConverter(xstream.getMapper()));
>> xstream.registerConverter(new
>> HibernatePersistentSortedSetConverter(xstream.getMapper()));
>>
>> Admittedly I'm not sure if this is correct.
>
> You should register the JavaBeanConverter with low priority again, since
> it handles any type with a default constructor - except the onces that are
> handled by the later registered converters.
And, by the way, since String has a default ctor, it is now handled by the
JavaBeanConverter ... no wonder, that those tags are empty.
>> I didn't see anything similar
>> in the test code that comes with the source distribution. I've tried
>> various configurations without success.
>
>
> How does the class looks like that contains "abbrev"? Is the code snippet
> above all you do for configuring XStream? Any additional XStream
> annotations anywhere?
Cheers,
Jörg
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email