[EMAIL PROTECTED] wrote:
Check the torque schema DTD - there is an onDelete attribute to foreign-key elements that you could set to cascade. I can't guarantee that this has been implemented or that it works with all databases - you will need to try it out.Hi All I am trying to write an application that deletes a row from a base Table called Person. the "id" column is the primaryKey for the "Person" table. There are lots of tables in the db that reference the "id" from the Person. Can i also delete all the references from the db if i say
doDelete(personObject);
Please let me know.
Scott
Hi,
I'm using the tdk with turbine 2.3, (I guess) Torque 3.0 and mysql 4x. It didn't work by default with just onDelete="CASCADE". To use this database function, you have to use InnoDB with mysql. For this, it seems that you have to run through your database and chance the ISAM-Tables with ALTER to InnoDB, since I haven't found any option in the DTD to define the type of table. But even this didn't make the ON DELETE appear in the references. I'm also still searching for a solution or best practise.
An idea of mine was to put a function into every object class named "deleteCascade", which calls the generated function get<ObjectsReferencingThis>s(), calls for each object of the resulting list "deleteCascade()", and finally deletes the current object.
Like with Scott's "Persons", some of these functions might become huge, especially since some Exceptions needed to be caught...
Feel free to critisize my idea and suggest better ones. :)
Ah, and sorry for my bad English. I'm not posting on English mailing lists very often. :)
Thomas
-- Thomas Ebeling Software Engineer conis Informationssysteme GmbH Hohenzollerndamm 196 10717 Berlin Germany Tel.: +49 (0) 30 / 86 31 34 00 Fax: +49 (0) 30 / 86 31 34 02 Mobile: +49 (0) 151 / 15 10 56 67 email: [EMAIL PROTECTED] Internet: www.conis.de
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]