db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomasz Dre├čler <tdr...@terragate.net>
Subject How do I use the feature onUpdate="cascade" with Torque?
Date Thu, 04 Mar 2004 16:02:29 GMT
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: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message