Hi Nresh,

My personal experience is that I needed a wrapper class to have our complete
"working memory" marshalled+unmarshalled. Butthere might be some other way.

And according to the castor documentation the references should be mapped as
node="attribute".

regards,
Peter

> ----------
> Von:  Naresh Bhatia[SMTP:[EMAIL PROTECTED]]
> Antwort an:   [EMAIL PROTECTED]
> Gesendet:     Mittwoch, 12. Februar 2003 09:41
> An:   [EMAIL PROTECTED]
> Betreff:      Re: [castor-dev] Problem with collection of references
> 
> Hi Peter,
> 
> Sorry, I am bit slow in understanding your answer. What I have is a
> many-to-many relationship between Calendars and Meetings. So a Calendar
> can have many Meetings on it and a Meeting can be on many Calendars.
> Assume I have the follows Calendar and Meeting instances in memory:
> 
>     C1--M1
>       \/
>       /\
>     C2--M2
> 
> So I expect to see something like this in the XML output:
> 
> <root>
> 
>   <calendars>
>     <calendar calendar-id="C1">
>       <meeting-ref meeting-id="M1"/>
>       <meeting-ref meeting-id="M2"/>
>     </calendar>
>     <calendar calendar-id="C2">
>       <meeting-ref meeting-id="M1"/>
>       <meeting-ref meeting-id="M2"/>
>     </calendar>
>   </calendars>
> 
>   <meeting meeting-id="M1" .../>
>   <meeting meeting-id="M2" .../>
> 
> </root>
> 
> Is this an unreasonable expectation? What I am marshalling is a
> "Calendars" object which contains a list of calendars, and these
> calendars have references to (shared) meetings. Should I instead
> Marshall another wrapper object that has contains the calendars and the
> meetings? The closest I have come to the XML output shown above is by
> specifying:
> 
>   <field name="meetings" type="Meeting" collection="array">
>     <bind-xml name="meeting-ref" node="element" reference="true"/>
>   </field>
> 
> This gives me
> 
> <calendars>
>   <calendar calendar-id="C1">
>     <meeting-ref>M1</meeting-ref>
>     <meeting-ref>M2</meeting-ref>
>   </calendar>
>   <calendar calendar-id="C2">
>     <meeting-ref>M1</meeting-ref>
>     <meeting-ref>M2</meeting-ref>
>   </calendar>
> </calendars>
> 
> Note that:
> 1) meetingIds come in as text of the <meeting-ref> element. If I specify
> node="attribute", I get
>        <calendar calendar-id="C1" meeting-ref="M1 M2">
>    This is similar to what you indicated below. Is this how collections
> of references should be?
> 
> 2) Meetings are not marshalled at all. I guess, I need to marshall a
> wrapper object that contains
>    the calendars as well as the meeting objects.
> 
> Please let me know how to proceed. Thanks for your help.
> Naresh
> 
> 

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to