title: Error in parsing JSON entity in spring JPA
body: <p>I have two entity Course and Teacher. There is a many to many bidirectional mapping b/w them.
  This is Course.java</p>
  
  <pre><code>@Entity
  @Table(name = "course")
  // @JsonIdentityInfo(generator = 
  ObjectIdGenerators.PropertyGenerator.class, property = "id")
  public class Course implements Serializable {
  
   @GeneratedValue(strategy = GenerationType.TABLE, generator = 
   "course_gen")
   @TableGenerator(name = "course_gen", table = "course_id_gen", 
   pkColumnName = "GEN_NAME",valueColumnName = "GEN_VAL", pkColumnValue= "CourseId_Gen", initialValue = 30000, allocationSize = 100)
   @Id
   @Column(name = "course_id")
   private int id;
  
   @Field(index = Index.YES, analyze = Analyze.YES)
   @Column(name = "course_title", length = 10000)
   private String courseTitle;
  
   @Field(index = Index.YES, analyze = Analyze.YES)
   @Column(name = "course_name", length = 10000)
   private String courseName;
  
   @Field(index = Index.YES, analyze = Analyze.YES)
   @Column(name = "course_description", length = 30000)
   private String courseDescription;
  
   @Field(index = Index.YES, analyze = Analyze.YES)
   @Column(name = "course_image")
   private String courseImage;
  
   @Field(index = Index.YES, analyze = Analyze.YES)
   @Column(name = "course_image_url")
   private String courseImageUrl;
  
   @JsonIgnoreProperties(value = "courses")
   @ManyToMany(fetch = FetchType.LAZY)
   @JoinTable(name = "course_instructors_linkage",joinColumns 
   {@JoinColumn(name = "course_id")},inverseJoinColumns = 
   {@JoinColumn(name = "course_instructor_id")})
   private Set&lt;Instructor&gt; instructors;
  </code></pre>
  
  <p>This is Instructor.java</p>
  
  <pre><code>@Entity
  @Indexed
  @Table(name = "instructor")
  @JsonIdentityInfo(generatorObjectIdGenerators.PropertyGenerator.class, property = "id")
  public class Instructor implements Serializable {
  
  @GeneratedValue(strategy = GenerationType.TABLE, generator 
  "teacher_details_gen")
  @TableGenerator(name = "teacher_details_gen", table = 
  "instructor_id_gen", pkColumnName = "GEN_NAME", 
  valueColumnName = "GEN_VAL", pkColumnValue = "instructor_Gen",
  initialValue = 100, allocationSize = 1)
  @Id
  int id;
  
  @Field(index = Index.YES, analyze = Analyze.YES)
  @Column(name = "teacher_name")
  private String teacherName;
  
  @Field(index = Index.YES, analyze = Analyze.YES)
  @Column(name = "teacher_description", length = 30000)
  private String teacherDescription;
  
  @JsonIgnoreProperties(value = "instructors")
  @ManyToMany(fetch = FetchType.LAZY, mappedBy = "instructors", cascade 
  = CascadeType.ALL)
  private Set&lt;Course&gt; courses = new LinkedHashSet&lt;Course&gt;();
  </code></pre>
  
  <p>Now, I am fetching all the courses from the DB using JPA query</p>
  
  <pre><code>Page&lt;Course&gt; response = courseRepository.findAll(pageable);
  </code></pre>
  
  <p>When I am parsing the above response, it looks like this:-
  <a href="https://i.stack.imgur.com/qoylb.png" rel="nofollow noreferrer">enter image description here</a> .</p>
  
  <p>During parsing of the above response, the inner entity (here it is Instructor) of the first index showed correct info with all the attribute but parsing next index of the same response having same inner entity does not show the correct info.</p>
  
  <p>What is the problem? 
  I am new to this field please help me.</p>