Hi William! The problem is that you're updating the primary key. You call something like emailObj.setEmail("[EMAIL PROTECTED]"). The old EMail-Address is overwritten and not longer present. If you now call emailObj.save() a update will be performed due to emailObj.isNew() returns false. Torque will generate a SQL statement like "UPDATE EMAIL SET ... WHERE EMAIL.EMAIL = "[EMAIL PROTECTED]". This update will fail because no such row will be found in your database. You will have to do a doUpdate yourself.
Here's an example for solving your problem: Criteria value = new Criteria(); value.add(EMailPeer.EMAIL, "[EMAIL PROTECTED]"); Criteria selection = new Criteria(); selection.add(EMailPeer.EMAIL, currentEMail.getEMail()); EMailPeer.doUpdate(selection, value); Hope this helps. F. Fray P.S. Be aware of changing a primary key! Not only referential integrity in your database must be guaranteed by you application, but the identity of your eMail object will change also. You should take a minute to think about choosing an eMail-address as primary key of a table. In most cases a numeric identifier will be the first choice. ----- Originalnachricht ----- Von: "??(William)" <[EMAIL PROTECTED]> Datum: Donnerstag, 17. Juni 2004 1:58 am Betreff: need help > > Hi All, > > I need help. > > I set email as a table' primary key, can I modify this field > through Torque save() method. > > looks it don't work, when I first retrive obj from old email > primary key, then I change email field using setEmail() method, > > at last, obj.save(), but it doesn't replace email field with new > data. > > Could anyone tell me what the problem is ? > > > William > > > > > ------------------------------------------------------------------- > -- > 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]