Note that there are some explanatory texts on larger screens.

plurals
  1. POJackson 2: Parsing a ton of classes through JPA associations, is it possible to limit the depth?
    primarykey
    data
    text
    <p>I've been trying to develop a RESTful layer on top of a working Spring MVC 3.1.2 application using Jackson 2.2.2 as a Json (de)serializer. Problem is, it's going way too deep into the references and for a page that used to take at most 1 second to load before now takes 22 seconds server-side only.</p> <p>The problem is Jackson is going through every single association and takes forever to load everything and to parse it.</p> <p>I know about <code>@JsonIgnore</code> but well, I'd rather have a depth limitation because if we have let's say:</p> <p><img src="https://i.stack.imgur.com/cxzCV.png" alt="My amazing explanation"></p> <p>If I put <code>@JsonIgnore</code> on the link between B and C then I'd be good when serializing A but then what if I need to serialize B and want C serialized along? The best way I can think of would be to give the serializer a depth-level limitation. Let's say, depth limit = 1 then it wouldn't serialize C when serializing A but would still serialize it when serializing B. Is there any way to do such thing?</p> <p>I've seen the <code>@JsonView</code> annotation but it's designed to include properties and not for excluding them. It can be used to exclude some properties but it's only relevant on a one-class level.</p> <p><strong>Do I need to write my own serializer? Is there a way to implement such a thing if I write my own serializer?</strong></p> <p>I can't think this isn't addressable but I can't find anything helping my case... </p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload