users@jersey.java.net

Re: [Jersey] JPA -> JAXB -> XML/JSON ??

From: Felipe Gaúcho <fgaucho_at_gmail.com>
Date: Tue, 31 Mar 2009 20:26:11 +0200

humm.. the bookmark example also copies the values from the entity to
a serializable object :(

            URI userUri = ub.
                    path(userEntity.getUserid()). <<< here
                    build();


it only uses an attribute and not the entity itself :(

so, my question is still open..

2009/3/31 Felipe Gaúcho <fgaucho_at_gmail.com>:
> I tought I was forced to use JAXB, but if I can expose my entities
> directly in the resources, much better ... let me see.............
>
> On Tue, Mar 31, 2009 at 7:55 PM, Arul Dhesiaseelan <arul_at_fluxcorp.com> wrote:
>> Felipe Gaúcho wrote:
>>>
>>> then I have the persistence layer based on JPA (@Entity).. and I need
>>> JAXB annotated types in order to serialize them through my Jersey
>>> resources ....
>>>
>>> how do you do this conversion ?
>>>
>>> design alternatives also helps.. in case Jersey is not designed to
>>> work on top of a persistence layer.............
>>>
>>>
>>
>> You could see the bookmark example which uses JPA and JSON. You could easily
>> change it to use JAXB.
>> I prefer to avoid conversion at various layers, so you could probably
>> annotate your JPA entity using JAXB. But, it all depends how you want to
>> expose your model to the users. In my case, I had to add @XmlTransient for
>> some of the data which should not be exposed to users.
>>
>> HTH,
>> -Arul
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>
>
>
> --
>
> Please help to test this application:
> http://fgaucho.dyndns.org:8080/cejug-classifieds-richfaces
>



-- 
Please help to test this application:
http://fgaucho.dyndns.org:8080/cejug-classifieds-richfaces