Personally I'd update the person object, then pass that to the database
update. For example, I have a form, that I post and create an instance of a
form object. This holds the data I've just filled the form in with. I can
then call methods on that object, like validate, then pass it to the
database object to store the values. In the even of a failed validate or on
completion of the database save, I can pass the object back to the form to
repopulate it with the entered values.

I've found that this works well on the forms where data is being changed,
validated, saved then redisplayed.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Vidar Einlien
Sent: 16 July 2004 09:36
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] object persistence


I'm also wondering how you would do an update to a database. In a practical
way I mean. 
This is what I have so far. A PersonObject(with getters/setters), a
PersonDAO(handles sql only) and a PersonManager. This is what I do: 
First I retrieve a person from PersonManager which calls the PersonDAO and
PersonObject. I now have a Person which I fill the form with. This is where
I have a problem. What do I do now? I have a update() method in
PersonManager which calls the PersonDAO. What I'm not sure about is should I
first call the PersonObject and update the properties with the new form
values or just do it directly meaning I don't use the PersonObject. My
problem is I'm not sure how I would do it if I need to call the PersonObject
first and then use PersonObject to update the database. Hope I make sense
here I'm new to this OO approach...

This is how I retrieve a person form PersonManager(all simplified of
course):
<cfset PersonDAO.read(PersonObject, arguments) /> 
This gives me a Person and is working.

And update:
<cfset PersonDAO.update(argumentCollection=arguments) /> 
This updates and person and is working. But how should I do it if I call the
PersonObject first?



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to