Say I have a profile form on my site. The user fills in the updated
information and then I use the setXXX methods in the Model class, in
this case User, to update the information. However, in order for it
to update and not add a new record, I need to have an instance of
the record which I am working with from the relation table.
So....my question is, is it always necessary to retrieve a record
before doing save() in order to make it update a record which
already exists? If so, would I do something like:
User user = UserPeer.findByUsername("sampleUsername");
if (user == null)
{
user = new User();
}
user.setPassword("foobar");
user.save();
Does that look about right?
Dan
--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Daniel Allen, <[EMAIL PROTECTED]>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
'One Microsoft Way' is more than just an address.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]