title: Hibernate One-To-Many JoinColumn with same name
body: <pre><code>Entity(name = "Assignment")
  class Assignment {
    @Id
    private int id;
  
    private String assignmentCode;
  
  }
  
  Entity(name = "Review")
  class Review {
    @Id
    private int id;
  
    private String assignmentCode;
  }
  </code></pre>
  
  <p>I have 2 tables each with 2 columns as above.
  I want to create a list of reviews in the assignment entity and these reviews are joined on the column assignmentCode.</p>
  
  <p>In the Assignment, I defined as below :</p>
  
  <pre><code>@OneToMany(targetEntity = Review.class, fetch=FetchType.EAGER)
  @JoinColumn(name="assignmentCode")
  private List&lt;Review&gt; reviews = new ArrayList&lt;Review&gt;();
  </code></pre>
  
  <p>but when I retrieve Assignment assignment = session.findById(Assignment.class, id);
  I'm getting the exception Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Ambiguous column name 'assignmentCode'</p>
  
  <p>What's the correct to define the reviews collection?
  I cannot change the table structures to have different column names.</p>