title: How to delete all child rows when parent is deleted using Hibernate?
body: <p>I have 2 tables.</p>
  
  <pre><code>// Accounts
  @OneToMany(mappedBy="accounts", cascade=CascadeType.ALL)
  @Cascade(org.hibernate.annotations.CascadeType.ALL)
  private Set&lt;Mails&gt; mails;
  
  // Mails
  @ManyToOne(cascade=CascadeType.ALL)
  @JoinColumn(name="user_id" , referencedColumnName="id", insertable=false, updatable=false)
  private Accounts accounts;
  </code></pre>
  
  <p>How can I organize deleting all child rows when the parent row will be deleted? I have tried to set <code>CascadeType.DELETE_ORPHAN</code> for the <code>Accounts</code> table, but with that I can't delete parent rows if a child row exists.</p>