cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: Help with Jersey Rest Services and Cayenne
Date Thu, 02 Jun 2011 11:43:49 GMT
This means that your serializer tries to serialize DataContext attached to DataObjects. Which
is strange, as "objectContext" property of a PersistentObject is declared as "transient",
so you would think it should be skipped by JAXB (??)

XML (or other types of serialization) of framework-managed objects is a pretty involved topic.
So my advise would be to use your own POJO data transfer objects (DTO) to work with JAXB (those
can be auto generated from the model with custom templates if you want). 

I am using Jersey/JAXB/JSON/XML with Cayenne a lot myself. However I've never had to deal
with direct serialization and for a different reason - the data that I want to expose to my
end users never has one-to-one correspondence with the database model. So an extra DTO layer
allows me to tweak the output for a particular type of Jersey resource.


On Jun 1, 2011, at 9:52 PM, Tony Dahbura wrote:
> I am utilizing the JAXB annotations to convert my objects from Cayenne into XML and/or
Jason format. The Jersey/JAXB libraries are complaining: 
> SEVERE: Mapped exception to response: 500 (Internal Server Error) 
> com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException:
7 counts of IllegalAnnotationExceptions 
> org.apache.cayenne.access.DataContextDelegate is an interface, and JAXB can't handle
> this problem is related to the following location: 
> at org.apache.cayenne.access.DataContextDelegate 
> I have read elsewhere on this problem but am not quite clear on how to get around this.
Can someone offer some guidance? 
> Thanks so much-this group is great! 
> Tony 

View raw message