title: Foreign key must have same number of columns as the referenced primary key for manyToMany
body: <p>here job has a set of employees, and employee have a set of jobs, but Spring give me this exception</p>
  
  <blockquote>
    <p>Caused by: org.hibernate.MappingException: Foreign key
    (FK1kec5bwba2rl0j8garlarwe3d:account [employee_id])) must have same
    number of columns as the referenced primary key (employee
    [job_id,employee_id])</p>
  </blockquote>
  
  <p>this is my employee class :</p>
  
  <pre><code>@Entity
  public class Employee {
  
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  private Integer id ;
  private String firstname ;
  private String lastname ;
  private String email ;
  private String phone ;
  private String address ;
  @OneToOne(cascade = CascadeType.ALL)
  @JoinColumn(name = "account_id")
  private Account account ;
  
  public Account getAccount() {
      return account;
  }
  public void setAccount(Account account) {
      this.account = account;
  }
  
  @ManyToOne
  @JoinColumn(name = "departement_id")
  @JsonIgnore
  private Departement departement ;
  @ManyToMany(cascade = CascadeType.ALL)
  @JoinTable(name = "jobs", joinColumns = @JoinColumn(name = "employee_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "job_id", referencedColumnName = "id"))
  private Set&lt;Job&gt;jobs ;
  
  
  ....
  
  }
  </code></pre>
  
  <p>and here is my job class :</p>
  
  <pre><code>@Entity
  @Inheritance
  
  public abstract class Job {
  
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  private Integer id ;
  
  private String status ; // (pending or done)
  private Date date ;
  
  @ManyToMany(cascade = CascadeType.ALL)
  @JoinTable(name = "employee", joinColumns = @JoinColumn(name = "job_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "employee_id", referencedColumnName = "id"))
  private Set&lt;Employee&gt; employee ;
  
  @ManyToOne
  @JoinColumn(name = "BusinnesPartner_id")
  @JsonIgnore
  private BusineesPartner busineesPartner ;
  
  
  
  
  
  
  
  
  }
  </code></pre>
  
  <p>Please can you explain to me why I get this exception.</p>