title: JPA Entity relationship: Cascade on delete
body: <p>I am using spring, JPA with Hibernate.</p>
  
  <p>I got the following entities:</p>
  
  <pre><code>@Entity
  @Table(name = "Supplier")
  public class Supplier {
  
     @Id
     @Column(name = "Supplier_ID", nullable = false)
     private Integer supplierId;
  
     ...
  }
  </code></pre>
  
  <p>and,</p>
  
  <pre><code>@Entity
  @Table(name = "Product")
  public class Product {
  
     @Id
     private Integer productId;
  
     @ManyToOne(cascade = CascadeType.ALL)
     @OnDelete(action = OnDeleteAction.CASCADE)
     @JoinColumn(name = "Supplier_ID")
     private Supplier supplier;
  
     ...
  }
  </code></pre>
  
  <p>Now, my question is, with the given schema</p>
  
  <ol>
  <li>when I delete a row from child ( ie. Product), will the Supplier will also get deleted?</li>
  <li>Or, it is only when the Parent (ie. Supplier) get deleted then it is cascaded to delete all the child 'Products'</li>
  </ol>
  
  <p>Thanks.</p>