This one time, at band camp, Vu, Christophe said:

VC >I'd like to know if anybody has a simple xml mapping file with a one to many
VC >relationship...Mine does not working and I really don't know why.
VC >
VC ><mapping>
VC >    <class name="cka.Prod" identity="id" access="shared">
VC >        <map-to table="prod" />
VC >            <field name="id" type="integer" required="false"
VC >direct="false" lazy="false">
VC >                <sql name="id" type="integer" dirty="check"
VC >/>
VC >            </field>
VC >            <field name="name" type="string" required="false"
VC >direct="false" lazy="false">
VC >                <sql name="name" type="char" dirty="check"
VC >/>
VC >            </field>
VC >            <field name="price" type="integer" required="false"
VC >direct="false" lazy="false">
VC >                <sql name="price" type="integer"
VC >dirty="check" />
VC >            </field>
VC >            <field name="groupId" type="integer"
VC >required="false" direct="false" lazy="false">
VC >                <sql name="groupId" type="integer"
VC >dirty="check" />
VC >            </field>
VC >            <field name="ProdDetails" type="cka.ProdDetail"
VC >required="false" collection="collection" >
VC >                    <sql many-key="prod_id" />
VC >                </field>
VC ></class>
VC >
VC ><class name="cka.ProdDetail" identity="id" depends="cka.Prod"
VC >access="shared">
VC >        <map-to table="Prod_Detail" />
VC >            <field name="name" type="string" required="false">
VC >                    <sql name="name" type="char" dirty="check"
VC >/>
VC >                </field>
VC >    </class>
VC ></mapping>

Christophe,

It would appear that this mapping descritpor does, in fact, establish
the many side of the relation in the cka.Prod. However, it does not
establish the one side of the relation in cka.ProdDetail. cka.ProdDetail
must have a relation similar to the following:

    <field name="prod" type="cka.Prod">
        <sql name="prod_id" />
    </field>

For another example of this, please see the mapping for the Castor
JDO examples in src/tests/jdo/mapping.xml.

Bruce
--

perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

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

Reply via email to