title: Deleting JPA object fails due to foreign key constraints?
body: <p>Why would the following query fail due to a foreign key constraint? There is no other way for me to delete the associated data that I am aware of.</p>
  
  <pre><code>Query query=em.createQuery("DELETE FROM Person");
  query.executeUpdate();
  em.getTransaction().commit();
  </code></pre>
  
  <p>The I believe the offending relationship causing the problem is the <code>activationKey</code> field:</p>
  
  <pre><code>2029 [main] ERROR org.hibernate.util.JDBCExceptionReporter - integrity
  constraint violation: foreign key no action; FKCEC6E942485388AB
  table: ACTIVATION_KEY
  </code></pre>
  
  <p>This is what I have now:</p>
  
  <pre><code>@Entity
  @Table(name="person")
  public class Person implements Comparable&lt;Person&gt; {
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      @Column(name="id")
      private long id = 0;
  
      @ElementCollection
      @Column(name = "activation_key")
      @CollectionTable(name = "activation_key")
      private Set&lt;String&gt; activationKey = new HashSet&lt;String&gt;();
  }
  </code></pre>