Java Mailing List Archive

http://www.gg3721.com/

Home » Hibernate Issues List »

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

Anupam M (JIRA)

2010-09-03

Replies: Find Java Web Hosting

Author LoginPost Reply

  [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=38273#action_38273 ]

James Wong commented on HHH-5528:
---------------------------------

Does this mean when using hibernate, the only way to delete objects that use an @ElementCollection annotation must be deleted one by one. ie by doing a query and then individually deleting each object? Or is there some other documentation I have missed?

> 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
>      Attachments: HHH-5528.tar.gz
>
>
> 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

   
_______________________________________________
hibernate-issues mailing list
hibernate-issues@(protected)
https://lists.jboss.org/mailman/listinfo/hibernate-issues
©2008 gg3721.com - Jax Systems, LLC, U.S.A.