title: Hibernate OneToMany and ManyToOne error in mapping
body: <p>I have an entity called User with these fields :</p>
  
  <pre><code>@Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column(name = "user_id")
  private Long id;    
  
  @Column(name = "name")
  private String name;
  
  @Column(name = "last_name")
  private String lastName;
  
  @OneToMany(mappedBy="userId")   
  private List&lt;Survey&gt; survey= new ArrayList&lt;&gt;();
  </code></pre>
  
  <p>And the Survey entity which has :</p>
  
  <pre><code>@Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column(name = "SURVEY_ID")
  private Long Id;
  
  @ManyToOne
  @JoinColumn(name = "user_id",referencedColumnName="user_id")
  private User userId;
  .....
  </code></pre>
  
  <p>I want one User to be have many Surveys, and each survey is related to one user.
  But there is something wrong with the way I've mapped it, cuz as JSON file, when I access allUsers I get this :</p>
  
  <pre><code>[{"id":1,"name":"User","lastName":"user","email":"user@user.com","surveyData":[{"userId":{"id":1,"name":"User","lastName":"user","email":"user@user.com","surveyData": ,...... and repeats itself
  </code></pre>
  
  <p>So instead of getting as list the values of the survey data, I get the values of the Users information ?
  Can someone help me with this ?</p>