Hi Arnd,

When you say type="java.util.HashSet" you're saying that this is *always* going to be an instance of that class, for both marshalling and unmarshalling. Do you want to create an instance of org.hibernate.collection.PersistentSet when unmarshalling? If so, you can use a factory-method to supply an instance for JiBX to use, in which case you can just use type="org.hibernate.collection.PersistentSet". If you want this to instead be a java.util.HashSet when unmarshalling, you can supply a factory-method to create an instance of HashSet without using the type="..." attribute.

In 1.1 I'm looking at adding an attribute create-type to give the class to be created when unmarshalling (which could be different from the actual type present when marshalling). For now the factory-method approach is the best you can do.

 - Dennis

Dennis M. Sosnoski
SOA, Web Services, and XML
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-296-6194 - Wellington, NZ +64-4-298-6117



Arnd Scharpegge wrote:

Hi

I have a problem marshalling an object. Input is a 
org.hibernate.collection.PersistentSet and output has to be a HashSet.
But when the data are processed, I always get the following error:

java.lang.ClassCastException: org.hibernate.collection.PersistentSet
at model.Document.JiBX_config_mappings_jibx_binding_marshal_3_5(Document.java)
at model.JiBX_config_mappings_jibx_bindingDocument_access.marshal()
at model.Document.marshal(Document.java)

Here is the JIBX binding:


field="documentTaxAmounts"
name="document-tax-amounts"
type="java.util.HashSet"
usage="optional"
/>

How can this problem be helped? I tried various propositions from your 
documentation, but in vain.

______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
jibx-devs mailing list
jibx-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-devs



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
jibx-devs mailing list
jibx-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to