title: JPA - Cannot delete row due to foreign key constraint
body: <p>I am using JPA2 (EclipseLink) and my entity objects look like this:</p>
  
  <pre><code>@Entity
  public class Dashboard
  {
      @Id
      private String name;
  
      @OneToMany(cascade = CascadeType.ALL, mappedBy="dashboard", orphanRemoval = true)
      private List&lt;LogResult&gt; logResults;
  
      //getter-setters
  }
  
  @Entity
  public class LogResult
  {
      @Id
      @GeneratedValue(strategy = GenerationType.TABLE)
      private long id;
  
      private Dashboard dashboard;
  
      //getter-setters
  }
  </code></pre>
  
  <p>and I have code like this to delete a dashboard:</p>
  
  <pre><code>EntityManager em = PersistenceInitializer.newEntityManager();
  em.getTransaction().begin();
  em.remove(dashboard);
  em.getTransaction().commit();
  </code></pre>
  
  <p>However when I execute the code above, I get an error msg regarding a foreign key constraint on the logresult table.</p>
  
  <p>Why is this so? Doesn't using CascadeType.ALL mean all that should be handled for me?</p>
  
  <p><strong>Update</strong> here is the actual error output on the console </p>
  
  <pre><code>Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`crs`.`logresult`, CONSTRAINT `FK_LOGRESULT_DASHBOARD_NAME` FOREIGN KEY (`DASHBOARD_NAME`) REFERENCES `dashboard` (`NAME`))
  Error Code: 1451
  </code></pre>