jackk jackk - 1 year ago 285
Java Question

JsonManagedReference vs JsonBackReference

I would like to now what is the difference between @JsonManagedReference and @JsonBackReference in Jackson?

Answer Source

@JsonManagedReference is the forward part of reference – the one that gets serialized normally. @JsonBackReference is the back part of reference – it will be omitted from serialization.

So they really depend on the direction of your relationship

public class User {
    public int id;
    public String name;

    public List<Item> userItems; } 

public class Item {
    public int id;
    public String itemName;

    public User owner; 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download