Please excuse me for being a muppet. I've just realised that the id should
be before the depends.

D'oh

-----Original Message-----
From: Mark Duncan [mailto:[EMAIL PROTECTED]]
Sent: 21 September 2001 11:46
To: [EMAIL PROTECTED]
Subject: [castor-dev] Problems loading and removing related objects


Hi,

I have two related objects in my database but using castor I can't get the
child objects(Contacts) to be loaded when I load the parent object(Account).
I have an collection(ArrayList) of contacts declared in my Account object
but when ever I load an Account object the collection is not populated with
the related Contact objects also, when I remove an Account object the
related Contact are still in the database. Any pointers on what I may be
doing wrong? I have included my mapping file as I believe this is where the
problem lies.

Cheers,

Mark



<mapping>

        <!--  Mapping for Account  -->

        <class name="uk.co.servsoft.servc.dao.Account" identity="id">
                <cache-type type="unlimited"/>
                <map-to table="account" xml="account"/>
                <field name="id" type="string">
                        <sql name="account_id" type="varchar"/>
                        <bind-xml name="id" node="attribute"/>
                </field>
                <field name="name" type="string">
                        <sql name="name" type="varchar"/>
                        <bind-xml name="name" node="element"/>
                </field>
                <field name="referenceNo" type="string">
                        <sql name="reference_no" type="varchar"/>
                        <bind-xml name="reference-no" node="element"/>
                </field>
                <field name="type" type="string">
                        <sql name="type" type="varchar"/>
                        <bind-xml name="type" node="element"/>
                </field>
                <field name="status" type="string">
                        <sql name="status" type="varchar"/>
                        <bind-xml name="status" node="element"/>
                </field>
                <field name="createdBy" type="string">
                        <sql name="created_by" type="varchar"/>
                        <bind-xml name="created-by" node="attribute"/>
                </field>
                <field name="lastUpdatedBy" type="string">
                        <sql name="last_updated_by" type="varchar"/>
                        <bind-xml name="last-updated-by" node="attribute"/>
                </field>
                <field name="createdDate" type="date">
                        <sql name="created_date" type="date"/>
                        <bind-xml name="created-date" node="attribute"/>
                </field>
                <field name="lastUpdatedDate" type="date">
                        <sql name="last_updated_date" type="date"/>
                        <bind-xml name="last-updated-date" node="attribute"/>
                </field>
                </field>
                <field name="contact" type="uk.co.servsoft.servc.dao.Contact"
required="true" collection="collection">
                        <sql many-key="contact_id"/>
                        <bind-xml name="contact" node="element"/>
                </field>
        </class>


        <!--  Mapping for Contact  -->
        <class name="uk.co.servsoft.servc.dao.Contact"
depends="uk.co.servsoft.servc.dao.Account" identity="id">
                <cache-type type="unlimited"/>
                <map-to table="contact" xml="contact"/>
                <field name="id" type="string">
                        <sql name="contact_id" type="varchar"/>
                        <bind-xml name="id" node="attribute"/>
                </field>
                <field name="title" type="string">
                        <sql name="title" type="varchar"/>
                        <bind-xml name="title" node="element"/>
                </field>
                <field name="firstname" type="string">
                        <sql name="firstname" type="varchar"/>
                        <bind-xml name="firstname" node="element"/>
                </field>
                <field name="middlename" type="string">
                        <sql name="middlename" type="varchar"/>
                        <bind-xml name="middlename" node="element"/>
                </field>
                <field name="lastname" type="string">
                        <sql name="lastname" type="varchar"/>
                        <bind-xml name="lastname" node="element"/>
                </field>
                <field name="email" type="string">
                        <sql name="email" type="varchar"/>
                        <bind-xml name="email" node="element"/>
                </field>
                <field name="telephone" type="string">
                        <sql name="telephone" type="varchar"/>
                        <bind-xml name="telephone" node="element"/>
                </field>
                <field name="mobile" type="string">
                        <sql name="mobile" type="varchar"/>
                        <bind-xml name="mobile" node="element"/>
                </field>
                <field name="fax" type="string">
                        <sql name="fax" type="varchar"/>
                        <bind-xml name="fax" node="element"/>
                </field>
                <field name="type" type="string">
                        <sql name="type" type="varchar"/>
                        <bind-xml name="type" node="element"/>
                </field>
                <field name="status" type="string">
                        <sql name="status" type="varchar"/>
                        <bind-xml name="status" node="element"/>
                </field>
                <field name="createdBy" type="string">
                        <sql name="created_by" type="varchar"/>
                        <bind-xml name="created-by" node="attribute"/>
                </field>
                <field name="lastUpdatedBy" type="string">
                        <sql name="last_updated_by" type="varchar"/>
                        <bind-xml name="last-updated-by" node="attribute"/>
                </field>
                <field name="createdDate" type="date">
                        <sql name="created_date" type="date"/>
                        <bind-xml name="created-date" node="attribute"/>
                </field>
                <field name="lastUpdatedDate" type="date">
                        <sql name="last_updated_date" type="date"/>
                        <bind-xml name="last-updated-date" node="attribute"/>
                </field>
                <field name="account" type="uk.co.servsoft.servc.dao.Account">
                        <sql name="account_id"/>
                        <bind-xml name="account" node="element"/>
                </field>
        </class>
</mapping>

E-mail Disclaimer/Confidentiality Notice Private and Confidential: This
message may contain privileged/confidential information. If you are not the
intended recipient (or responsible for its delivery to such recipient),
please inform us and delete this message immediately. The notes below are an
important and integral part of this message and should be also be read
Notes: 1. It is your responsibility to carry out such virus or other checks
as are appropriate to ensure that this message and any attachments do not
affect your systems or data. This message has been virus-scanned by us
before sending but we shall not be held responsible for any effect that
there may be on your systems or data. 2. Any views, opinions, conclusions or
other information in this message which do not relate to the business of
this firm are not authorised by us. 3. Unless specifically stated in this
message and authorised by us, nothing in this message shall be taken to be
an offer or acceptance of any contract of any nature. 4. We do not accept
responsibility for any changes made to this message after it was originally
sent.

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