Sure can.

physicianService.cfc

<cfcomponent name="PhysicianService "output="false">

   <!--- Constructor --->
<cffunction name="init" access="public" output="false" returntype="PhysicianService" hint="Constructor">
       <cfreturn this />
   </cffunction>

<cffunction name="getPhysicians" access="public" returntype="query" output="false"> <cfreturn getPhysicianGateway().getByFields(argumentCollection=arguments) />
   </cffunction>

   <cffunction name="getPhysician" access="public" output="false">
<cfargument name="PR_ID" type="numeric" required="true" default="0" /> <cfreturn getPhysicianDAO().load(argumentCollection=arguments) />
   </cffunction>

   <cffunction name="savePhysician" access="public" output="false">
<cfargument name="PhysicianRecord" type="reactor.base.abstractrecord" required="true"> <cfreturn getPhysicianDAO().savePhysician(physicianRecord=arguments.physicianRecord,argumentCollection=arguments) /> </cffunction>

<cffunction name="setReactorFactory" returntype="void" access="public" output="false">
       <cfargument name="reactorFactory" type="any" required="true" />
       <cfset variables.reactorFactory = arguments.reactorFactory />
   </cffunction>
<cffunction name="getReactorFactory" access="public" returntype="any" output="false" roles="" hint="">
       <cfreturn variables.reactorFactory />
   </cffunction>

<cffunction name="setPhysicianDAO" returntype="void" access="public" output="false">
       <cfargument name="PhysicianDAO" type="any" required="true" />
       <cfset variables.PhysicianDAO = arguments.PhysicianDAO />
   </cffunction>
<cffunction name="getPhysicianDAO" access="public" returntype="any" output="false" roles="" hint="">
       <cfreturn variables.PhysicianDAO />
   </cffunction>
<cffunction name="setPhysicianGateway" returntype="void" access="public" output="false">
       <cfargument name="PhysicianGateway" type="any" required="true" />
       <cfset variables.PhysicianGateway = arguments.PhysicianGateway />
   </cffunction>
<cffunction name="getPhysicianGateway" access="public" returntype="any" output="false" roles="" hint="">
       <cfreturn variables.PhysicianGateway />
   </cffunction>
</cfcomponent>

Byron

Chris Blackwell wrote:
Byron,

Its fairly clear that if adding the init argument forces the creation
of a new record, then the old one is being cached in your MG
application, and getPhysician is not returning a new instance, but the
cached one.

I'm only a MG newbie, but i'd say the problem lies within your
PhysicianService.  Can you post the code for this so we can take a
look

Chris


On Feb 18, 2008 5:25 PM, Byron Raines <[EMAIL PROTECTED]> wrote:
Chris,
    OK.  I think I understand what's going on here about the loading.
But things are still not adding up.

Sorry for the length of the following.  I'm just trying to provide as
much in as possible.

I ran the following:

coldspring.xml:
    <!-- Setup physician-related components -->
    <bean id="physicianService" class="Heart2Heart.model.PhysicianService">
        <property name="reactorFactory">
            <ref bean="reactorFactory" />
        </property>
        <property name="physicianGateway">
            <ref bean="physicianGateway" />
        </property>
        <property name="physicianDAO">
            <ref bean="physicianDAO" />
        </property>
   </bean>


physicianController.cfc:
    <cffunction name="getPhysician" access="public" returntype="void"
output="false" hint="">
        <cfargument name="event" type="ModelGlue.Core.Event"
required="true" />

            <cfset arguments.event.setValue('getPhysician',
getPhysicianService().getPhysician()) />
    </cffunction>

physicianService.cfc

    <cffunction name="getPhysician" access="public" output="false">
        <cfreturn getPhysicianDAO() />
    </cffunction>

 modleglue.xml:

        <event-handler name="physician.test" access="public">
            <broadcasts>
                <message name="getNewPhysician" />
            </broadcasts>
            <results>
                <result do="view.template"/>
            </results>
            <views>
                <include name="body" template="test.cfm" append="true">
                </include>
            </views>
        </event-handler>

test.cfm:
<cfset user = viewstate.getValue("getPhysician")>

<cfset user.load()>
<cfdump var="#user.isDirty()#">
<cfdump var="#user._getTo()#">
<cfset user.load(PR_ID=2)>
<cfdump var="#user.isDirty()#">
<cfdump var="#user._getTo()#">
<cfset user.load(PR_ID=0)>
<cfdump var="#user.isDirty()#">
<cfdump var="#user._getTo()#">

I ran event=physician.test

Model-Glue 2.0: Unity
NO
component Heart2Heart.model.data.reactor.To.tblPhysicianTomssql
<http://localhost:8501/CFIDE/componentutils/cfcexplorer.cfc?method=getcfcinhtml&name=Heart2Heart.model.data.reactor.To.tblPhysicianTomssql>

        extends Heart2Heart.model.data.reactor.To.tblPhysicianTo
<http://localhost:8501/CFIDE/componentutils/cfcexplorer.cfc?method=getcfcinhtml&name=Heart2Heart.model.data.reactor.To.tblPhysicianTo>

EMAIL   [empty string]
RESIDENTYR      [empty string]
EDUCATIONSESSION        [empty string]
PR_ID   0
REASONREFUSED   [empty string]
STANDING        [empty string]
PHYSICIANID     [empty string]
CONSENT         [empty string]
FIRSTNAME       [empty string]
LASTNAME        [empty string]
REASONREFUSEDOTHER      [empty string]
PRESTUDYSURVEY  [empty string]
ENROLLED        [empty string]
METHODS
_CONFIGURE

function _configure
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
config
        Required
        any

alias
        Required
        any

ReactorFactory
        Required
        any

Convention
        Required
        any



/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I configure and return this object.
/Description:/




_GETBEAN

function _getBean
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
name
        Required
        any



/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I set a BeanFactory (Spring-interfaced IoC container) to inject into
all created objects).
/Description:/




_GETALIAS

function _getAlias
/Arguments:/
        none
/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_SETCONFIG

function _setConfig
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
config
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_COPY

function _copy
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
To
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I copy another TO's values into this TO. Properties which exist in both
TOs are copied from the provided TO to this TO.
/Description:/




_SETCONVENTION

function _setConvention
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
convention
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_SETREACTORFACTORY

function _setReactorFactory
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
reactorFactory
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_SETNAME

function _setName
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
name
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_GETSIGNATURE

function _getSignature
/Arguments:/
        none
/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I return this object's corrisponding DB signature.
/Description:/




_SETBEANFACTORY

function _setBeanFactory
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
beanFactory
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I set a BeanFactory (Spring-interfaced IoC container) to inject into
all created objects).
/Description:/




_ISEQUAL

function _isEqual
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
To
        Required
        any



/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I indicate if two TOs are the same in terms of type and values. If any
of the values in the TO can not be converted to a string them this will
return false.
/Description:/





NO
component Heart2Heart.model.data.reactor.To.tblPhysicianTomssql
<http://localhost:8501/CFIDE/componentutils/cfcexplorer.cfc?method=getcfcinhtml&name=Heart2Heart.model.data.reactor.To.tblPhysicianTomssql>

        extends Heart2Heart.model.data.reactor.To.tblPhysicianTo
<http://localhost:8501/CFIDE/componentutils/cfcexplorer.cfc?method=getcfcinhtml&name=Heart2Heart.model.data.reactor.To.tblPhysicianTo>

EMAIL   [EMAIL PROTECTED]
RESIDENTYR      [empty string]
EDUCATIONSESSION        3
PR_ID   2
REASONREFUSED   [empty string]
STANDING        1
PHYSICIANID     99-006
CONSENT         1
FIRSTNAME       Jim
LASTNAME        Evans
REASONREFUSEDOTHER      [empty string]
PRESTUDYSURVEY  0
ENROLLED        1
METHODS
_CONFIGURE

function _configure
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
config
        Required
        any

alias
        Required
        any

ReactorFactory
        Required
        any

Convention
        Required
        any



/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I configure and return this object.
/Description:/




_GETBEAN

function _getBean
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
name
        Required
        any



/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I set a BeanFactory (Spring-interfaced IoC container) to inject into
all created objects).
/Description:/




_GETALIAS

function _getAlias
/Arguments:/
        none
/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_SETCONFIG

function _setConfig
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
config
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_COPY

function _copy
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
To
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I copy another TO's values into this TO. Properties which exist in both
TOs are copied from the provided TO to this TO.
/Description:/




_SETCONVENTION

function _setConvention
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
convention
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_SETREACTORFACTORY

function _setReactorFactory
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
reactorFactory
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_SETNAME

function _setName
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
name
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_GETSIGNATURE

function _getSignature
/Arguments:/
        none
/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I return this object's corrisponding DB signature.
/Description:/




_SETBEANFACTORY

function _setBeanFactory
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
beanFactory
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I set a BeanFactory (Spring-interfaced IoC container) to inject into
all created objects).
/Description:/




_ISEQUAL

function _isEqual
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
To
        Required
        any



/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I indicate if two TOs are the same in terms of type and values. If any
of the values in the TO can not be converted to a string them this will
return false.
/Description:/





YES
component Heart2Heart.model.data.reactor.To.tblPhysicianTomssql
<http://localhost:8501/CFIDE/componentutils/cfcexplorer.cfc?method=getcfcinhtml&name=Heart2Heart.model.data.reactor.To.tblPhysicianTomssql>

        extends Heart2Heart.model.data.reactor.To.tblPhysicianTo
<http://localhost:8501/CFIDE/componentutils/cfcexplorer.cfc?method=getcfcinhtml&name=Heart2Heart.model.data.reactor.To.tblPhysicianTo>

EMAIL   [EMAIL PROTECTED]
RESIDENTYR      [empty string]
EDUCATIONSESSION        3
PR_ID   0
REASONREFUSED   [empty string]
STANDING        1
PHYSICIANID     99-006
CONSENT         1
FIRSTNAME       Jim
LASTNAME        Evans
REASONREFUSEDOTHER      [empty string]
PRESTUDYSURVEY  0
ENROLLED        1
METHODS


I run it again:

Model-Glue 2.0: Unity
YES
component Heart2Heart.model.data.reactor.To.tblPhysicianTomssql
<http://localhost:8501/CFIDE/componentutils/cfcexplorer.cfc?method=getcfcinhtml&name=Heart2Heart.model.data.reactor.To.tblPhysicianTomssql>

        extends Heart2Heart.model.data.reactor.To.tblPhysicianTo
<http://localhost:8501/CFIDE/componentutils/cfcexplorer.cfc?method=getcfcinhtml&name=Heart2Heart.model.data.reactor.To.tblPhysicianTo>

LASTNAME        Evans
CONSENT         1
RESIDENTYR      [empty string]
PHYSICIANID     99-006
STANDING        1
EMAIL   [EMAIL PROTECTED]
ENROLLED        1
REASONREFUSEDOTHER      [empty string]
PR_ID   0
PRESTUDYSURVEY  0
FIRSTNAME       Jim
EDUCATIONSESSION        3
REASONREFUSED   [empty string]
METHODS
_GETALIAS

function _getAlias
/Arguments:/
        none
/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_CONFIGURE

function _configure
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
config
        Required
        any

alias
        Required
        any

ReactorFactory
        Required
        any

Convention
        Required
        any



/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I configure and return this object.
/Description:/




_SETBEANFACTORY

function _setBeanFactory
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
beanFactory
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I set a BeanFactory (Spring-interfaced IoC container) to inject into
all created objects).
/Description:/




_GETBEAN

function _getBean
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
name
        Required
        any



/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I set a BeanFactory (Spring-interfaced IoC container) to inject into
all created objects).
/Description:/




_ISEQUAL

function _isEqual
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
To
        Required
        any



/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I indicate if two TOs are the same in terms of type and values. If any
of the values in the TO can not be converted to a string them this will
return false.
/Description:/




_SETCONFIG

function _setConfig
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
config
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_SETREACTORFACTORY

function _setReactorFactory
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
reactorFactory
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_SETCONVENTION

function _setConvention
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
convention
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_GETSIGNATURE

function _getSignature
/Arguments:/
        none
/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I return this object's corrisponding DB signature.
/Description:/




_COPY

function _copy
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
To
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I copy another TO's values into this TO. Properties which exist in both
TOs are copied from the provided TO to this TO.
/Description:/




_SETNAME

function _setName
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
name
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/





NO
component Heart2Heart.model.data.reactor.To.tblPhysicianTomssql
<http://localhost:8501/CFIDE/componentutils/cfcexplorer.cfc?method=getcfcinhtml&name=Heart2Heart.model.data.reactor.To.tblPhysicianTomssql>

        extends Heart2Heart.model.data.reactor.To.tblPhysicianTo
<http://localhost:8501/CFIDE/componentutils/cfcexplorer.cfc?method=getcfcinhtml&name=Heart2Heart.model.data.reactor.To.tblPhysicianTo>

LASTNAME        Evans
CONSENT         1
RESIDENTYR      [empty string]
PHYSICIANID     99-006
STANDING        1
EMAIL   [EMAIL PROTECTED]
ENROLLED        1
REASONREFUSEDOTHER      [empty string]
PR_ID   2
PRESTUDYSURVEY  0
FIRSTNAME       Jim
EDUCATIONSESSION        3
REASONREFUSED   [empty string]
METHODS
_GETALIAS

function _getAlias
/Arguments:/
        none
/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_CONFIGURE

function _configure
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
config
        Required
        any

alias
        Required
        any

ReactorFactory
        Required
        any

Convention
        Required
        any



/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I configure and return this object.
/Description:/




_SETBEANFACTORY

function _setBeanFactory
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
beanFactory
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I set a BeanFactory (Spring-interfaced IoC container) to inject into
all created objects).
/Description:/




_GETBEAN

function _getBean
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
name
        Required
        any



/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I set a BeanFactory (Spring-interfaced IoC container) to inject into
all created objects).
/Description:/




_ISEQUAL

function _isEqual
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
To
        Required
        any



/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I indicate if two TOs are the same in terms of type and values. If any
of the values in the TO can not be converted to a string them this will
return false.
/Description:/




_SETCONFIG

function _setConfig
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
config
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_SETREACTORFACTORY

function _setReactorFactory
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
reactorFactory
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_SETCONVENTION

function _setConvention
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
convention
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/




_GETSIGNATURE

function _getSignature
/Arguments:/
        none
/ReturnType:/
        any

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I return this object's corrisponding DB signature.
/Description:/




_COPY

function _copy
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
To
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/
        I copy another TO's values into this TO. Properties which exist in both
TOs are copied from the provided TO to this TO.
/Description:/




_SETNAME

function _setName
/Arguments:/
*Name*
        *Required*
        *Type*
        *Default*
name
        Required
        any



/ReturnType:/
        void

/Roles:/


/Access:/
        public

/Output:/
        false
/DisplayName:/

/Hint:/

/Description:/





YES
component Heart2Heart.model.data.reactor.To.tblPhysicianTomssql
<http://localhost:8501/CFIDE/componentutils/cfcexplorer.cfc?method=getcfcinhtml&name=Heart2Heart.model.data.reactor.To.tblPhysicianTomssql>

        extends Heart2Heart.model.data.reactor.To.tblPhysicianTo
<http://localhost:8501/CFIDE/componentutils/cfcexplorer.cfc?method=getcfcinhtml&name=Heart2Heart.model.data.reactor.To.tblPhysicianTo>

LASTNAME        Evans
CONSENT         1
RESIDENTYR      [empty string]
PHYSICIANID     99-006
STANDING        1
EMAIL   [EMAIL PROTECTED]
ENROLLED        1
REASONREFUSEDOTHER      [empty string]
PR_ID   0
PRESTUDYSURVEY  0
FIRSTNAME       Jim
EDUCATIONSESSION        3
REASONREFUSED   [empty string]
METHODS


Notice how when I re-run the page the first isDirty changes from No to
Yes.  When I rerun the page, am I not creating a new record?  That's
what the 'getPhysician' method in participant service is supposed to do.
A new record was created on the first run, but not on the second.  I'm
not reload ing the page, I calling the page a second time.  If I add an
init=true, it does create the blank record the second time.  Fro some
reason, I just not cluing in.

Thanks

Byron


Chris Blackwell wrote:
I do a load(ID=0) which is supposed to load a new record, but the previous
record is loaded, even though ID is set to 0.

Incorrect, load(ID=0) does not load a new record, it TRIES to load a
record with ID=0 but as no record exists it will fail. load(ID=0) is
the shorthand for setID(0) and then load().

Heres an example of whats going on, modify it to fit your app and take a look

<cfset user = reactor.createRecord("User")>
<cfset user.load(id=2)>
<cfdump var="#user.isDirty()#">
<cfdump var="#user._getTo()#">
<cfset user.load(id=0)>
<cfdump var="#user.isDirty()#">
<cfdump var="#user._getTo()#">

Notice that after the second load call isDirty() will return true
because load failed and the data in the record is now dirty.

Its not safe to reuse a single instance of a Record in your
application.  You should create a new Record object and then call load
on it each time.  DAO, Gateways and Validators are safe to be cached
for reuse.

Cheers, Chris

On Feb 18, 2008 6:51 AM, Byron Raines <[EMAIL PROTECTED]> wrote:

Sorry, misunderstood.  There is no record with ID=0 after the save.  The
ID is auto-increment, so there should never be a record with ID=0.  The
problem I'm running into is that whenever I am loading an existing
record, the next time time I load a blank record, int this case I'm
using ID=0 since I do not have any records with ID=0, the values from
the last loaded existing record are loaded (ie firstname, lastname, etc).

Let me add that if I do:  event=participant.edit&ID=0&init=true
I blank record is loaded (I assume since I an reloading the app).

Hope I'm explaining this clearly.
Byron

Brian Kotek wrote:

What I'm saying is that after you do this:

1.)  Load a record (ID=5).
2.)  Make changes and save.
3.)  Redirected to the main listing page.

Stop and go look at the database and confirm that there is no record
with an ID of 0 in there, because if there is, and you do load(ID=0)
you'll get that record.

On Feb 17, 2008 10:21 PM, Byron Raines <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:

    Brian,
       ID is the primary key and auto-increment.  If I load (ID=5), it
    saves as 5.  If I load with (ID=0), if remembers the previous loaded
    record, then saves with a new ID.  I don't see how reactor is
    remembering a record that was loaded from 2 requests prior.

    1.)  Load a record (ID=5).
    2.)  Make changes and save.
    3.)  Redirected to the main listing page.
    4.)  Then create a blank record (ID=0).  The record from (ID=5) is
    loaded.  However, getID() is equal to 0.
    5.)  Save that record and a new record with new ID is saved.

    Byron

    Brian Kotek wrote:
    > If you look at the database, are you sure that the record you load
    > with an ID of 5 is being saved with an ID of 5, and not an ID of 0?
    >
    > On Feb 16, 2008 9:23 PM, Byron Raines <[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>

    > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote:
    >
    >     Hi.  I have a problem I just cannot figure out.
    >
    >     I have a situation where I am loading an existing record,
    editing,
    >     then
    >     saving it.  Then I load a new empty record.  However, the values
    >     of the
    >     previously loaded record are appearing on my form page.  I
    cannot
    >     figure
    >     out if I'm actually not loading a new record, or if its
    caching the
    >     previous record.  Example:  if do a load(ID=5), edit it,
    save it.
    >      The I
    >     do a load(ID=0) which is supposed to load a new record, but the
    >     previous
    >     record is loaded, even though ID is set to 0.
    >
    >     This is part of a Model-Glue 2.0 app.  I posted this on the
    model-glue
    >     google group included code samples etc.  While there were
    alot of good
    >     suggestions, I was not able to find anything that helped.
     If anyone
    >     would not mind taking a look at the thread and offer
    suggestions, I'd
    >     appreciate it.
    >
    >     This on is stumping me.
    >
    >
    
http://groups.google.com/group/model-glue/browse_thread/thread/3bcdc568347ce277
    >
    >     Byron
    >
    >
    >     -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    -- --
    >     -- -- -- -- --
    >     Reactor for ColdFusion Mailing List
    >     [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
    <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>

    >     Archives at:
    http://www.mail-archive.com/reactor%40doughughes.net/
    >     -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    -- --
    >     -- -- -- -- --
    >
    >
    >
    > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    > -- -- -- --
    > Reactor for ColdFusion Mailing List
    > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
    > Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
    > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    > -- -- -- --


    -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    -- -- -- -- --
    Reactor for ColdFusion Mailing List
    [EMAIL PROTECTED] <mailto:[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/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --



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

Reply via email to