[ http://jira.codehaus.org/browse/JIBX-77?page=all ]

Dennis Sosnoski updated JIBX-77:
--------------------------------

     Priority: Major  (was: Critical)
    Assign To: Dennis Sosnoski
         type: Wish  (was: Bug)

Probably the best way of handling this is by adding a new attribute with a name 
like "create-type" which is used only for determining the type of object to 
create when unmarshalling. The current "type" attribute has this effect, but it 
also effects everything else (including method lookup).

As a workaround for your problem, just define a static factory method to create 
instances of HashSet and use the "factory" attribute on the collection. This 
will take care of your issue without effecting the marshalling behavior.

> Collection type attribute should be used only for unmarshalling and not for 
> marshalling
> ---------------------------------------------------------------------------------------
>
>          Key: JIBX-77
>          URL: http://jira.codehaus.org/browse/JIBX-77
>      Project: JiBX
>         Type: Wish
>   Components: core
>     Versions: 1.0-RC0
>     Reporter: Jagannathan
>     Assignee: Dennis Sosnoski

>
>
> Hi,
> I am using Jibx with Hibernate. 
> Now i have a Model which has a property of type java.util.Set. Now there are 
> two scenario's in which this set would be initalised. one where Hibernate 
> loads it in which case the instance would be org.hibernate.PersistentSet and  
> in another case i would load the set in which case the instance would be 
> java.util.HashSet.
> Now the problem is when i define the Mapping i give the 
> <structure name="su">
>        <collection field="csu" type="java.util.HashSet"/>
> </structure>
> Now when i marshall the data from hibernate i get a classcastexception.
> I expect this Hashset to be used only in the case of unmarshalling where a 
> new instance for that property has to be created.
> Since other wise all marshalling operation can happen against the Interface 
> itself.
> But it is not happening so. The type is being used for both 
> unmarshalling/marshalling . what i would prefer is a scenario where the 
> declared type of the property is used for marshalling and the type specified 
> for the collection tag used for creating the new instance's only. 

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



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to