users@jersey.java.net

[Jersey] Re: RFE: JSON marshalling of entity w/lazy loaded property

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Wed, 7 Nov 2012 10:21:29 -0800

On Wed, Nov 7, 2012 at 9:06 AM, Noah White <emailnbw_at_gmail.com> wrote:
>
> It would be nice if JAX-RS / Jersey could leverage JPA's relationship annotations (@OneToMany etc.) fetch attribute, respecting whether or not it is LAZY and if it is LAZY to not try to traverse the property (and hence trigger its loading). Otherwise you are forced to use a DTO that does not contain the lazy loaded properties, iterate over your entity list creating DTOs and marshall the list of DTOs.

This might be easier to achieve on data-binding level (Jackson module
for JPA). Something similar exists in form of Jackson Hibernate module
(https://github.com/FasterXML/jackson-module-hibernate)

-+ Tatu +-