Thank  you Ollie.

My problem is that  "Message text..." is not within it's own tags.  So I
can not define a field with a ame "string":

 <field name="string" type="string">
                <sql name="string" type="varchar" />
                <bind-xml name="string" node="element" />
 </field>


Is the any solution for that?

<message flag=1> Message1 text........ </message>


About the version: It is me who is missing something. Does version 1.0
sounds right?

Thanks again.






                                                                                       
                                         
                    Oliver Epper                                                       
                                         
                    <oliver@epper        To:     [EMAIL PROTECTED]                 
                                         
                    .de>                 cc:                                           
                                         
                                         Subject:     Re: [castor-dev] mapping 
question                                         
                    10/26/01                                                           
                                         
                    05:12 AM                                                           
                                         
                    Please                                                             
                                         
                    respond to                                                         
                                         
                    castor-dev                                                         
                                         
                                                                                       
                                         
                                                                                       
                                         




Hi Tanya !

If the messageHolder can have multiple messages, but a message
is hold exclusively by one messageHolder then that relation is
a so called one-many-relation.
The mapping might look like:

...

<class name="message" identity="id" key-generator="keygen">
           <map to table="messages" />
           <field name="Id" type="integer">
                     <sql name="id" type="integer" />
                     <bind-xml name="Id" node="attribute"/>
           </field>
           <field name="flag" type="integer">
                     <sql name="flag" type="integer" />
                     <bind-xml name="flag" type="attribute" />
           </field>
           <field name="string" type="string">
                     <sql name="string" type="varchar" />
                     <bind-xml name="string" node="element" />
           </field>
           <!-- now the relation -->
           <field name="messageHolder" type="messageHolder">
                     <sql name="messageHolder_id" type="integer" />
                     <bind-xml name="mh" node="attribute" />
           </field>
</class>

<class name="messageHolder" identity="id" key-generator="keygen">
           <map to table="messageHolder" />
           <field name="Id" type="integer">
                     <sql name="id" type="integer" />
                     <bind-xml name="Id" node="attribute" />
           </field>
           <field name="message" type="message" required="false" collection
="vector">
                     <sql many-key="messageHolder_id" />
                     <bind-xml name="messages" node="element" />
           </field>
</class>

...

This would lead you to the following xml:

<messageHolder id="1">
           <message id="2" mh="1" flag="1">
                     <string>Message1 text...........</string>
           </message>
           <message id="3" mh="1" flag="1">
                     <string>Message2 text...........</string>
           </message>
</messageHolder>

If you really need to have the mentioned structure then maybe you want to
have
a Vector containing messages in the messageHolder class.
But I would suggest to use a xml-structure like:

<messageHolder>
           <message flag="1" text="Message1" />
           <message flag="2" text="Message2" />
</messageHolder>

which could be produced by the upper mapping by changing the node attribute
for
the text to attribute instead of element.

I hope that I got the point :) And by the way I've never heard of
castor version 1.2 though I would be glad :) Am I missing something ?

bye Ollie

Am Thu, Oct 25, 2001 at 05:12:42PM -0400,schrieb [EMAIL PROTECTED]:
> Hi,
>
> can anybody tell whether Castor can support the following XML structure:
>
>
> <messageHolder>
> <message flag=1> Message1 text........ </message>
> <message flag=1> Message2 text........ </message>
> </messageHolder>
>
>
> I can not figure out how to map the "message text" part
>
>
> We are using version Castor Exolabs 1.2
>
> Thank you,
> Tanya
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>          unsubscribe castor-dev
>

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

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

Reply via email to