title: Spring Data Jpa - ManyToMany - delete entities of the join table
body: <p>I have these two classes :</p>
  
  <pre><code>public class ClassA extends [...] implements [...] {
      @ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
      @JoinTable(name = JOIN_TABLE_NAME,
              joinColumns = @JoinColumn(name = COLUMN_REF_A, referencedColumnName = COLUMN_ID_A),
              inverseJoinColumns = @JoinColumn(name = COLUMN_REF_B, referencedColumnName = COLUMN_ID_B))
      private List&lt;ClassB&gt; fieldClassB;   
  }
  
  public class ClassB extends [...] implements [...] {
      @ManyToMany(fetch = FetchType.LAZY, mappedBy = "fieldClassB", cascade = CascadeType.ALL)
      private List&lt;ClassA&gt; fieldClassA;
  
  }
  </code></pre>
  
  <p>When I delete <code>ClassB</code> (via the spring data jpa repository), Hibernate also deletes instances of <code>ClassA</code>, whereas I just want the rows in the <code>JOIN_TABLE_NAME</code> table to be deleted (the other issue is that, due to the cascade mode, deleting the <code>ClassA</code> entities also delete other <code>ClassB</code> referenced by these <code>ClassA</code>).</p>
  
  <p>Is there any way to handle this without having to create the join entity and to replace the <code>@ManyToMany</code> annotations by <code>@OneToMany</code> referencing the new join entity ?</p>