title: Hibernate many-to-one annotation and error on delete
body: <p>I've this bean with annotations (showing the relevant ones):</p>
  
  <pre><code>@Entity
  @Table(name = "Prodotti")
  @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
  public class Prodotto {
      int id;
      String codice;
      double prezzo;
      double prezzoCanone;
      String descrizione;
      String note;
  
      Prodotto prodottoDiRiferimento;
  
  ...
  
      @ManyToOne(cascade = CascadeType.REMOVE)
      public Prodotto getProdottoDiRiferimento() {
          return prodottoDiRiferimento;
      }
  
      public void setProdottoDiRiferimento(Prodotto prodottoDiRiferimento) {
          this.prodottoDiRiferimento = prodottoDiRiferimento;
      }
  
  
  }
  </code></pre>
  
  <p>all mapped to mySQL. </p>
  
  <p>If I do a delete of one of these beans that has a prodottoDiRiferimento property set to null and that other beans have as they prodottoDiRiferimento, I get:</p>
  
  <pre><code>java.sql.BatchUpdateException: Cannot delete or update a parent row: a foreign key constraint fails (`jacciseweb`.`prodotti`, CONSTRAINT `FKC803BB11ACD3B812` FOREIGN KEY (`prodottoDiRiferimento_ID`) REFERENCES `prodotti` (`ID`))
  </code></pre>
  
  <p>What I'd like is that all the beans that point to the deleted one with the prodottoDiRiferimento property would get deleted too. </p>
  
  <p>How to do it?</p>