I have asked the question about support for IDREFs before,
but got no reply so far. I went through the code and
found that the support for IDREFS is there. It is enabled
if you mark a field descriptor as multivalued. But there is
no way to set this flag using a mapping file. So if you can
modify the Castor code you need not flatten your xml.

Hope this helps.

Subramanian




-----Original Message-----
From: Glen Edwards [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 26, 2002 8:52 AM
To: [EMAIL PROTECTED]
Subject: [castor-dev] IDREFS and mapping


Hello
I have been able to get IDREF to work using information from previous posts
using an existing model and a mapping file (schema generator is
not really an option). I am trying to get IDREFS to work, but without any
luck as I end up with a class cast exception when the code tries
to generate the IDREFS. I have an object Size, which contains a list of
SizeDescriptions. I am intending to flatten this (would rather not but that
is not my decision). For example.

<snip>
<SIZE ID="101" key="1" sizeDescriptions="12 14"/>
<SIZE-DESCRIPTION ID="12" size="101 info="stuff"/>
<SIZE-DESCRIPTION ID="14" size="101 info="stuff"/>
<snip>

Am I trying to reach too far on this? Is this possible in the current
version (using snaphot from cvs of 18th March 2002)

Thanks
Glen

I am using the following mapping file:
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
"http://castor.exolab.org/mapping.dtd";>
<mapping>


  <!-- Mapping for Size -->
  <class name="exit41.mumi.persist.Size" identity="id">
    <description>Size Reference Class</description>
    <map-to table="Sizes" xml="SIZE"/>
    <field name="id" type="integer" required="true">
      <bind-xml name="key" node="attribute"/>
    </field>

    <field name="description" type="exit41.mumi.persist.SizeDescription"
collection="arraylist" required="false">
      <bind-xml name="sizeDescriptions" node="attribute" reference="true"/>
    </field>
  </class>

  <!--  Mapping for SizeDescription  -->
  <class name="exit41.mumi.persist.SizeDescription"
depends="exit41.mumi.persist.Size" identity="idref">
    <description>NLS support for Sizes</description>
    <map-to table="NLSSizes" xml="SIZE-DESCRIPTION"/>
    <field name="idref" type="string"  get-method="getIDREF">
      <bind-xml name="ID" node="attribute"/>
    </field>
    <field name="size" type="exit41.mumi.persist.Size" required="true">
      <bind-xml name="sizeID" node="attribute" reference="true"/>
    </field>
  </class>

</mapping>

Glen Edwards
Elm Square Interactive/Exit41
Three Dundee Park
Andover, MA 01810
978-933-7464
[EMAIL PROTECTED]

----------------------------------------------------------- 
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