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.
[EMAIL PROTECTED]
//--------------------------------------------------------------------

---------------------------------------------------------------------
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]



Reply via email to