title: By Using @JsonBackReference and @JsonManagedReference in many to many relationship, data is missing
body: <p>I am having two models which is having many to many relations. I have used <strong>@JsonManagedReference</strong> and <strong>@JsonBackReference</strong> to avoid looping. </p>
  
  <p>When I retrieve JSON of Outage class it working fine it has set of instances value, but when I retrieve Instance it is not having outage set there.</p>
  
  <p>Here is my <strong>Outage.java</strong></p>
  
  <pre><code> public class Outage implements Serializable {
  
      /**
       * 
       */
      private static final long serialVersionUID = 3688202816610111558L;
  
      @Id
      @GeneratedValue
      @Column(name = "outage_id")
      private long outageId;
  
      @JsonManagedReference
      @ManyToMany(cascade = CascadeType.ALL)
      @JoinTable(name = "ManyToMany", 
      joinColumns = @JoinColumn(name = "outage_id"),
      inverseJoinColumns = @JoinColumn(name  = "instance_id"))
      private Set&lt;Instances&gt; instances;
  
      @Column(name = "start_date")
      private Date startDate;
  
      @Column(name = "end_date")
      private Date endDate;
  
      @Column(name = "start_time")
      private Time startTime;
  
      @Column(name = "end_time")
      private Time endTime;
  
      @Column(name = "outage_type")
      private int outageType;
  
      @Column(name = "jira_number")
      private String jiraNumber;
  
      @Column(name = "reason")
      private String reason;
  
      }
  </code></pre>
  
  <p>Here is my <strong>Instances.java</strong></p>
  
  <pre><code>public class Instances implements Serializable {
  
  /**
   * 
   */
  private static final long serialVersionUID = -5280937805735107384L;
  
  @Id
  @GeneratedValue
  @Column(name = "instance_id")
  private long id;
  
  @Column(name = "name")
  private String instanceName;
  
  @ManyToOne
  @JoinColumn(name = "application_id")
  private Applications applications;
  
  @ManyToOne
  @JoinColumn(name = "environment_id")
  private Environments environments;
  
  @JsonBackReference
  @ManyToMany(cascade = CascadeType.ALL, mappedBy = "instances")
  private Set&lt;Outage&gt; outages;
  
  }
  </code></pre>
  
  <p>Here is my respective <strong>JSON</strong></p>
  
  <p><strong>Outage JSON</strong></p>
  
  <pre><code>{
  "outageList": [{
      "outageId": 40,
      "instances": [{
          "id": 10,
          "instanceName": null,
          "applications": null,
          "environments": null,
          "version": null
      }, {
          "id": 9,
          "instanceName": "UAT7",
          "applications": null,
          "environments": null,
          "version": null
      }],
      "startDate": "3916-06-06",
      "endDate": "3916-06-06",
      "startTime": "01:00:00",
      "endTime": "12:00:00",
      "outageType": 1,
      "jiraNumber": "123",
      "reason": "checking without applicaion &amp; envi"
  }]}
  </code></pre>
  
  <p><strong>Instances</strong></p>
  
  <pre><code>{
  "instancesList": [{
      "id": 9,
      "instanceName": "UAT7",
      "applications": null,
      "environments": null,
      "version": null
  }, {
      "id": 10,
      "instanceName": null,
      "applications": null,
      "environments": null,
      "version": null
  }]}
  </code></pre>
  
  <p>Thanks in advance</p>