db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Broadhead <robbroadh...@mindspring.com>
Subject Re: How do I use the feature onUpdate="cascade" with Torque?
Date Thu, 04 Mar 2004 17:10:31 GMT
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.


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 
>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 
>In sql I would write this query:
>update server set serveradress='newServerAdress' where 

Rob Broadhead - Consultant
RB Consulting Inc.

To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message