I think the problem is that you define your Bean property as a
Collection, not a Set.  But hibernate is expecting an object which
implements the Set interface.  When FDS deserializes the ActionScript
Array collection, it needs to know to convert it to a Set on the server
side so it is compatible with what hibernate expects.  

 

Make the bean property be a java.util.Set and we'll stuff a HashSet in
there and hibernate should be happy.

 

Jeff

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Alberto Albericio
Sent: Wednesday, May 23, 2007 1:52 AM
To: [email protected]
Subject: [flexcoders] Cast Exception from FDS to Hibernate

 

Hi all,

I have an hibernate mapping defined with some properties and a
relationship:

<set name="items" table="..." lazy="false">
<key column="..."/>
<one-to-many class="..."/>
</set>

This relationship is defined in the java bean as:

private Collection items;

On the Flex side, I'm receiving this relationship as an ArrayCollection.

The serialization from java.util.Collection to Flex ArrayCollection 
works fine but, when I try to save the changes made on the client side (

what, on the server side, gets translated into 
getHibernateTemplate().update ( .. ) ), it just fails throwing this
error:

java.lang.ClassCastException : flex.messaging.io.ArrayCollection cannot 
be cast to java.util.Set

Im stuck and I dont know what to do. Any ideas?

Thank you!

Alberto

 

Reply via email to