db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Hughes <mhu...@ucalgary.ca>
Subject Re: Cascading delete?
Date Mon, 07 Apr 2003 21:34:37 GMT
Gabriel Bauman writes:
 > 
 > Okay, so...
 > 
 >  > <table name="CHILD_TABLE">
 >  >    <column
 >  >      name="child_id"
 >  >      required="true"
 >  >      primaryKey="true"
 >  >      type="INTEGER"
 >  >      autoIncrement="true"
 >  >    />
 > >   <foreign-key foreignTable="PARENT_TABLE"
 > >     name="PARENT_TABLE_FK"
 > >     onDelete="cascade">
 > >     <reference local="child_id" foreign="parent_id"/>
 > >   </foreign-key>
 >  > </table>
 > 
 > ... given this example, if I delete or update the OM's ParentTable 
 > object, the associated records in CHILDTABLE should be deleted, right?
 > 
 > ParentTablePeer.doDelete(ParentTable);
 > 
 > Unfortunately, this does not work for me. The ParentTable record is 
 > deleted, but the children are not. Perhaps I need to tell the 
 > ParentTable instance to load its children explicitly? What am I missing?

What database are you using? PostgreSQL supports cascading deletes
nativly, but MySQL only does for InnoDB tables.... I believe that
Torque will silently ignore those options if the target database
doesn't support them.

-- 
 Matt Hughes
  + mhughe@ucalgary.ca
  + http://www.enel.ucalgary.ca/~hughes
  + "Were there monkeys? Some terrifying space monkeys maybe got loose?"

Mime
View raw message