users@jersey.java.net

Re: [Jersey] Unmarshalled JSON not populating original class is was marshalled from.

From: Jakub Podlesak <Jakub.Podlesak_at_Sun.COM>
Date: Tue, 05 Jan 2010 18:04:03 +0100

Hi Paul,

could you please share your JAXB beans? Without that it is hard to tell
what is going wrong in your case.
The best would be to file a new bug report and attach a reproducible
test case as a maven project. If that is not possible, could you please
just send the JAXB bean sources and an example code populating
the marshalled instance?

Thanks,

~Jakub

On Tue, Jan 05, 2010 at 04:49:56PM +0000, Paul Taylor wrote:
> Hi, Im using Jersey together with JAXB and Lucene.
> I have a JAXB class which I marshall to a JSON String representation
> and store in a lucene index, together with some search fields. Then when
> a user gets a match I unmarshall the JSON back to the original class and
> not all fields are populated. If I marshal to XML instead it works fine,
> but the amount of space used by an XML field is significantly larger and
> the indexing takes longer so I would rather use JSON, Java serialization
> is even worse.
>
> So the Json String is
> correct:{"type":"group","id":"4302e264-1cf0-4d1f-aca7-2a6f89e34b36","name":"Farming
> Incident","sort-name":"Farming
> Incident","gender":"male","country":"af","life-span":{"begin":"1999-04","end":""}}
> but when unmarshalled back into Artist class, the LifeSpan class is not
> completed, i.e artist.getLifeSpan().getBegin() returns null when it
> should return "1999-04", fields at the top level (such as name,sort-name
> are okay)
>
>
> Is this a bug/limitation in Json or am I doing something wrong
>
> thanks Paul
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>

-- 
http://blogs.sun.com/japod