Ignore this mail. I figured it out. I have to manually set the reference.
Doh.

Keith C



-----Original Message-----
From: Keith Chew [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 9 October 2001 12:28 p.m.
To: [EMAIL PROTECTED]
Subject: [castor-dev] possible bug


Hi All

Very simple question. I have ObjectA with has many ObjectBs. When I create
ObjectA, it writes everything correctly to the DB. When I remove, it removes
form both tables correctly too.

However, when I:
(1) create ObjectA
(2) restart the application
(3) delete ObjectA

Now, the cache is empty in step (2), so it needs to reload from DB. However,
loading fails to create ObjectB. This is bad.

I did notice one thing. When ObjectA is created, the sql many-key (in this
case, it's a_id) will tell it how to load up ObjectB. But when I checked
b_table, the a_id is blank.

Possible bug during the creation of ObjectA?
Keith


        <!--  Mapping for ObjectA -->
  <class name="ObjectA" identity="id">
    <map-to table="a_table" xml="a" />
    <cache-type type="unlimited" />
    <field name="id" type="integer">
      <sql name="id" type="integer" />
      <bind-xml name="id" node="element" />
    </field>
    <field name="bs" type="ObjectB" required="true" collection="vector">
      <sql many-key="a_id"/>
      <bind-xml name="a_id" node="element" />
    </field>
  </class>

        <!--  Mapping for ObjectB -->
  <class name="ObjectB" depends="ObjectA" identity="id">
    <map-to table="b_table" xml="b" />
    <cache-type type="unlimited" />
    <field name="id" type="integer">
      <sql name="id" type="integer" />
      <bind-xml name="id" node="element" />
    </field>
    <field name="a" type="ObjectA">
      <sql name="a_id" />
      <bind-xml name="message_id" node="element" />
    </field>
  </class>

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