[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5528) Defining an object with an @ElementCollection prevents bulk delete

Jacob Rhode (JIRA) noreply at atlassian.com
Thu Sep 2 17:47:18 EDT 2010


Defining an object with an @ElementCollection prevents bulk delete
------------------------------------------------------------------

                 Key: HHH-5528
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5528
             Project: Hibernate Core
          Issue Type: Bug
    Affects Versions: 3.5.4
            Reporter: Jacob Rhode


The following query to delete a set of records, only works in some circumstances:

{code}
    Query query=em.createQuery("DELETE FROM Person");
    query.executeUpdate();
{code}

If you use an @ElementCollection and add some data, this query will fail. Example class:

{code:title=Person.java|borderStyle=solid}
@Entity
@Table(name="person")
    public class Person implements Comparable<Person> {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name="id")
    private long id = 0;

    @ElementCollection
    @Column(name = "activation_key")
    @CollectionTable(name = "activation_key")
    private Set<String> activationKey = new HashSet<String>();
}
{code}

The following error is generated while trying to bulk delete:

{code}
    2029 [main] ERROR org.hibernate.util.JDBCExceptionReporter - integrity
    constraint violation: foreign key no action; FKCEC6E942485388AB
    table: ACTIVATION_KEY
{code}

As a result, this means code that formerly worked using a bulk delete, can stop working due to an @ElementCollection being added to the associated Java class.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list