Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 88228 invoked from network); 6 Mar 2004 22:42:24 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 6 Mar 2004 22:42:24 -0000 Received: (qmail 65622 invoked by uid 500); 6 Mar 2004 22:42:09 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 65482 invoked by uid 500); 6 Mar 2004 22:42:08 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 65467 invoked from network); 6 Mar 2004 22:42:07 -0000 Received: from unknown (HELO terragate.net) (217.160.133.107) by daedalus.apache.org with SMTP; 6 Mar 2004 22:42:07 -0000 Received: by terragate.net (Postfix, from userid 1016) id 9C490142A0; Sat, 6 Mar 2004 23:42:13 +0100 (CET) Received: from terragate.net (dsl-082-083-110-164.arcor-ip.net [82.83.110.164]) by terragate.net (Postfix) with ESMTP id 375231429F for ; Sat, 6 Mar 2004 23:42:12 +0100 (CET) Message-ID: <404A5536.2040802@terragate.net> Date: Sat, 06 Mar 2004 23:48:22 +0100 From: =?ISO-8859-1?Q?Tomasz_Dre=DFler?= User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Apache Torque Users List Subject: Re: How do I use the feature onUpdate="cascade" with Torque? References: <40475315.9040304@terragate.net> <6.0.0.22.2.20040304101321.01bc12a0@pop.mindspring.com> <404760E1.5010002@terragate.net> <6.0.0.22.2.20040304110404.01bad740@pop.mindspring.com> In-Reply-To: <6.0.0.22.2.20040304110404.01bad740@pop.mindspring.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on terragate.net X-Spam-Status: No, hits=-4.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=2.60 X-Spam-Level: X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hello Rob Broadhead. Thank you for reply :) I don't find a way how I can update the database after I change the primary key of my server object. Can I use BasePeer to do this job? BasePeer.executeQuery() seems not be the right method. Now, I create a new server record. After this, I change the address of all related files. After this I delete the old server record. This solution is O.K. but I wish to have a better one. Greetings Tomek Rob Broadhead wrote: > I don't have your original code, but the way it works is you need to > retrieve the Server object for the row you want to change either using > criteria or retrieveByPK on the ServerPeer. Once you have the object > call the setServerAddress method to update the value and then save the > object. In order to cascade update the values you will need to use the > transactional methods (take a look at the javadocs for these, but they > are also fairly easy to use) instead of simply save() since you need > to do the whole set of updates in a single transaction, otherwise you > will have constraint issues when you update the parent or child table. > I hope this helps. > > Rob > > > At 11:01 AM 3/4/2004, you wrote: > >> Hi Rob Broadhead. >> I use Mysql witch allow to change PK. >> I don't get a SQL exception. Torqe do a "select from server where >> server.serveradress='newServerAdress'" >> when I call server.setServeradress("newServerAdress"). >> Of corse, such server is not in Database so Torque do nothing. >> In my code I don't do nothing. >> I fetch a server object with server.getServeradress() -> >> 'oldServerAdress'. >> And this object I would like to change in >> 'server.setServeradress("newServerAdress")'. >> >> >> In sql I would write this query: >> update server set serveradress='newServerAdress' where >> serveradress='oldServerAdress' >> >> \Tomek > > > //-------------------------------------------------------------------- > Rob Broadhead - Consultant > RB Consulting Inc. > Rob@RB-SNS.com > //-------------------------------------------------------------------- > > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org > For additional commands, e-mail: torque-user-help@db.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org