[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5862) ClassCastException overriding with a new Set a existing collection.

Andreas Kardos (JIRA) noreply at atlassian.com
Fri Jan 13 08:51:09 EST 2012


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

Andreas Kardos commented on HHH-5862:
-------------------------------------

Exampe: Entity Order with a 1:N relation to another entity OrderLine:

   @OneToMany(cascade = CascadeType.ALL, mappedBy = "order", orphanRemoval = true)
   protected Collection<OrderLine> orderLines;

This Exception is thrown when {{Order.orderLines}} is set to a {{HashSet}} and not to a e.g. {{ArrayList}}.

> ClassCastException overriding with a new Set a existing collection.
> -------------------------------------------------------------------
>
>                 Key: HHH-5862
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5862
>             Project: Hibernate ORM
>          Issue Type: Bug
>    Affects Versions: 3.6.0
>         Environment: testcase, java6, windows
>            Reporter: Francisco Philip
>
> Any idea?
> java.lang.ClassCastException: java.util.HashSet cannot be cast to org.hibernate.collection.PersistentCollection
> 	at org.hibernate.event.def.FlushVisitor.processCollection(FlushVisitor.java:57)
> 	at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:122)
> 	at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:83)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list