If you need to update the serverAdress in the 'server' table I think it's a better solution if you don't use this field as a primary key. You can add a SERVER_ID for primary key, and then you'll be able to update serverAdress and no changes are needed in the 'file' table.
[-------------------- schema.xml ---------------------------] <table name="server" description="Server Tabelle" idMethod="none"> <column name="SERVER_ID" required="true" primaryKey="true" type="INTEGER" autoIncrement="true" /> <column name="serverAdress" primaryKey="true" required="true" type="VARCHAR" size="255" description="Server Adresse" /> <column name="serverName" required="true" type="VARCHAR" size="128" description="Server Name" /> </table> <table name="file" description="File Tabelle" idMethod="native"> <column name="fileId" required="true" primaryKey="true" type="INTEGER" autoIncrement="true" description="File ID" /> <column name="SERVER_ID" required="true" type="INTEGER" description="FK Server ID" /> <column name="filePath" required="true" type="LONGVARCHAR" description="File Pfad" /> <column name="fileName" required="true" type="VARCHAR" size="255" description="File Name" /> <foreign-key foreignTable="server"> <reference local="SERVER_ID" foreign="SERVER_ID"/> </foreign-key> </table> -----Original Message----- From: Tomasz Dreßler [mailto:[EMAIL PROTECTED] Sent: Thursday, March 04, 2004 5:02 PM To: Apache Torque Users List Subject: How do I use the feature onUpdate="cascade" with Torque? Hi! I have the tables 'server' and 'file'. How can I update the 'server.serveradress' (PK) and 'file.serverAdress' (FK) with Torque? The attribute 'file.serverAdress' have the flag onUpdate="cascade". I try folowing: Criteria crit = new Criteria(); crit.add(ServerPeer.SERVERADRESS, "oldServerAdress"); List v = ServerPeer.doSelect(crit) Iterator iteratorServer = v.iterator(); Server server; if(iteratorServer.hasNext()){ server = (Server) iteratorServer.next(); } server.setServeradress("newServerAdress"); ServerPeer.doUpdate(server); // don't work server.save(); // don't work, too Thanks for your attention Greetings Tomek [------------------------- schema.xml --------------------------------------] <table name="server" description="Server Tabelle" idMethod="none"> <column name="serverAdress" primaryKey="true" required="true" type="VARCHAR" size="255" description="Server Adresse" /> <column name="serverName" required="true" type="VARCHAR" size="128" description="Server Name" /> </table> <table name="file" description="File Tabelle" idMethod="native"> <column name="fileId" required="true" primaryKey="true" type="INTEGER" autoIncrement="true" description="File ID" /> <column name="serverAdress" required="true" type="VARCHAR" size="255" description="FK Server Adresse" /> <column name="filePath" required="true" type="LONGVARCHAR" description="File Pfad" /> <column name="fileName" required="true" type="VARCHAR" size="255" description="File Name" /> <foreign-key foreignTable="server" onUpdate="cascade"> <reference local="serverAdress" foreign="serverAdress"/> </foreign-key> </table> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]