title: Delete records in ManyToMany relationship spring data jpa
body: <p>I have Two Entities. A and B. Relationship between <code>A</code> and <code>B</code> is <code>@ManyToMany</code>. So I have introduced Third entity <code>C</code> for <code>@ManyToMany</code> relationship as it needed for project.</p>
  
  <p>My Entity classes are look like following.</p>
  
  <pre><code>@Entity
  class A
  {
      @OneToMany(cascade = CascadeType.ALL, mappedBy = "a")
      List&lt;C&gt; cList;
  }
  
  @Entity
  class B
  {
      @OneToMany(cascade = CascadeType.ALL, mappedBy = "b")
      List&lt;C&gt; cList;
  }
  
  @Entity
  class C
  {
      @ManyToOne
      @JoinColumn(name = "ref_a")
      A a;
  
      @ManyToOne
      @JoinColumn(name = "ref_b")
      B b;
  }
  </code></pre>
  
  <p>Now, I want to delete record of entity <code>A</code> or <code>B</code> then it should delete respective record from <code>C</code>.
  But when I delete record of <code>A</code> or <code>B</code> it shows </p>
  
  <blockquote>
    <p>Cannot delete or update a parent row: a foreign key constraint fails</p>
  </blockquote>
  
  <p>What other configuration it need to delete record from <code>A</code> or <code>B</code> and it will also delete respective record from <code>C</code>?</p>