title: JPA: DELETE WHERE does not delete children and throws an exception
body: <p>I am trying to delete a large number of rows from <code>MOTHER</code> thanks to a JPQL query.</p>
  
  <p>The <code>Mother</code> class is defined as follows:</p>
  
  <pre><code>@Entity
  @Table(name = "MOTHER")
  public class Mother implements Serializable {
  
      @OneToMany(cascade = CascadeType.ALL, mappedBy = "mother", 
                 orphanRemoval = true)
      private List&lt;Child&gt; children;    
  }
  
  @Entity
  @Table(name = "CHILD")
  public class Child  implements Serializable {
  
      @ManyToOne
      @JoinColumn(name = "MOTHER_ID")
      private Mother mother;    
  }
  </code></pre>
  
  <p>As you can see, the <code>Mother</code> class has "children" and when executing the following query:</p>
  
  <pre><code>String deleteQuery = "DELETE FROM MOTHER WHERE some_condition";
  entityManager.createQuery(deleteQuery).executeUpdate();
  </code></pre>
  
  <p>an exception is thrown:</p>
  
  <pre><code>ERROR - ORA-02292: integrity constraint &lt;constraint name&gt; violated - 
                     child record found
  </code></pre>
  
  <p>Of course, I could first select all the objects I want to delete and retrieve them into a list before iterating through it to delete all the retrieved object, but the performance of such a solution would just be terrible!</p>
  
  <p>So is there a way to take advantage of the previous mapping to delete all the <code>Mother</code> objects AND all the <code>Child</code> objects associated with them efficiently and without writing first the queries for <strong>all</strong> the children?</p>