title: ManyToMany on itself with AssociationTable with EmbeddedId - Spring-Data-Jpa
body: <p>I have some trouble with Hibernate during a ManyToMany association :/
  I want to have a user with his contacts.
  The association Table is used to have a creation_date of the association and her status (ex. Active, inactive, etc...)</p>
  
  <ul>
  <li>Hibernate version : 5.2.17</li>
  <li>Spring boot : 2.0.5</li>
  </ul>
  
  <p><strong>My class USER :</strong></p>
  
  <pre><code>@Entity(name = "user")
  public class User implements Serializable {
  
  @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
  @JoinTable(name = "assoc_user_user", joinColumns = {@JoinColumn(name = 
  "id.myself.id")}, inverseJoinColumns = {@JoinColumn(name = 
  "id.contact.id")})
  private List&lt;AssocUserUser&gt; contacts;
  
  @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
  @JoinTable(name = "assoc_user_user", joinColumns = {@JoinColumn(name = 
  "id.contact.id")}, inverseJoinColumns = {@JoinColumn(name = 
  "id.myself.id")})
  private List&lt;AssocUserUser&gt; contactOf;
  
  }
  </code></pre>
  
  <p><strong>My Association class AssocUserUser :</strong></p>
  
  <pre><code>@Entity(name = "assoc_user_user")
  public class AssocUserUser implements Serializable {
  
  private static final long serialVersionUID = 1L;
  
  @EmbeddedId
  private AssocUserUserId id;
  
  @Column(name = "creation_date", nullable = false)
  private LocalDateTime creationDate;
  
  @Column(name = "status")
  @Enumerated(EnumType.STRING)
  private ContactStatusEnum status;
  
  }
  </code></pre>
  
  <p><strong>My EmbeddedId class AssocUserUserId :</strong></p>
  
  <pre><code>@Embeddable
  public class AssocUserUserId implements Serializable {
  
  private static final long serialVersionUID = 1L;
  
  @ManyToOne
  @JoinColumn(name = "user_id_myself", nullable = false)
  private User myself;
  
  @ManyToOne
  @JoinColumn(name = "user_id_contact", nullable = false)
  private User contact;
  
  }
  </code></pre>
  
  <p><strong>My Error :</strong> </p>
  
  <blockquote>
    <p>Caused by: org.hibernate.AnnotationException: A Foreign key refering
    com.....AssocUserUser from com.....User has the wrong number of
    column. should be 2</p>
  </blockquote>