Yes, there is a primary key set on both tables, with a foreign key on the appUser table pointing to the personID in the person table. For that matter, the load function works just fine passing in the primary key as well, so that part of this works.
Thanks. ---------------------------------------- Are you sure your primary keys are defined correctly? iirc, reactor will always insert rather than update if the table has no primary key Chris ---------------------------------------- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeff D. Chastain Sent: 29 November 2006 19:24 To: [email protected] Subject: Re: [Reactor for CF] Update vs. Insert? I pulled it down less than a month ago, but I am not finding a version number in any of the files. Do you know if there is one somewhere? Thanks. ---------------------------------------- Jeff, This intrigues me. What build of Reactor are you using? From your code, I can determine the schema easy enough. I would like to test a theory to see if I can recreate the issue. Teddy On 11/29/06, Jeff D. Chastain <[EMAIL PROTECTED]> wrote: Teddy, Yes, each appUser object has one related person object. It was my understanding from the reactor documentation that running the save method on the root/parent object would cascade through all of the updated child objects as well. Is this not correct? Also, I have tried simplifying this to only update a record in the appUser table ... using setPassword() to update the password, then running the save method for the appUser record object. This still creates a new record in the table even though I loaded an existing record first. It seems like Reactor only creates new records for me - it never updates. Thanks -- Jeff ---------------------------------------- Jeff, Am I assuming correctly that if for a given user, that you have a given person? If you return a person object and make changes to the person object, you need to save person before you save user. So, that would be two saves. <cfset person.save() /> <cfset appUser.save() /> Teddy On 11/29/06, Jeff D. Chastain <[EMAIL PROTECTED] > wrote: What does Reactor key off of to determine if the save method should trigger an update or an insert query? I have a fairly simple example below, which I thought would cause two records to be updated. However, a new record is being created in both tables with each run. Any suggestions on what I am missing here? Thanks. ------------------------------------------------------------------------------------------------------------- <!--- create reactor factory ---> <cfset rf = createObject ( 'component' , 'reactor.reactorFactory' ).init( expandPath ( "reactor.xml" )) /> <!--- create an appUser record ---> <cfset appUser = rf.createRecord( "appUser" ) /> <cfset appUser.load(appUserID= 100012 ) /> <!--- get the associated person record ---> <cfset person = appUser.getPerson() /> <!--- dump the appUser password---> <cfoutput> <p> #appUser.getPassword()# </p> </cfoutput> <!--- dump the person id and name ---> <cfoutput> <p> #person.getPersonID()# <br/> #person.getNameFirst()# <br/> #person.getNameLast()# </p> </cfoutput> <!--- update the appUser password ---> <cfset appUser.setPassword( 'test' ) /> <!--- update the person name ---> <cfset person.setNameFirst( 'John' ) /> <!--- save the appUser ---> <cfset appUser.save() /> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- <cf_payne /> Adobe Certified ColdFusion MX 7 Developer Atlanta CFUG (ACFUG): http://www.acfug.org -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- <cf_payne /> Adobe Certified ColdFusion MX 7 Developer Atlanta CFUG (ACFUG): http://www.acfug.org -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
