Clifford,

I'd bet this line is making singletons:

     <cfset var AdminBean
= getModelGlue().getBean("instanceFactory").getBean("AdminBean") />

As you know, a singleton in Model Glue is kept in the Model Glue scope. This
would explain why the record changes when you reload the application.

What you want, is for this bean to be created each time the method is run.
Let's have a look at the instanceFactory. Paste the code into your next
email.



DW


On Fri, Feb 18, 2011 at 9:18 AM, Clifford Moon <[email protected]>wrote:

> Greetings,
>
> I have the below adminBean.cfc file that links to my admin table.  I
> am using the following code in the controller:
>
>        <cffunction name="needAdminForm" access="public" returnType="void"
> output="false" hint="???">
>        <cfargument name="event" type="any">
>        <cfset var AdminBean =
> getModelGlue().getBean("instanceFactory").getBean("AdminBean") />
>        <cfset arguments.event.makeEventBean( AdminBean ) />
>        <cfset arguments.event.setValue( "AdminBean", AdminBean ) />
>        </cffunction>
>
> that I call before I go to create a new record.  I had an issue
> yesterday when I turned off RELOAD=TRUE in coldspring.xml where the
> last record I entered was coming up the next time I went to create a
> record.  What am I doing wrong, and how can I initialize this bean
> with empty fields before I put this form up so that when I put the
> RELOAD=FALSE back, it wont display the previous records data (and I
> was testing this from one browser to the next, creating the record in
> one, and then opening a new browser, going to add a new record, and
> there the data was,  so I'm assuming this bean data is stored in
> memory somewhere?).
>
> Not sure where I'm going wrong, but any help would be greatly
> appreciated.
>
> Thanks in Advance,
>
> Cliff
>
> **********Adminbean.cfc****************************
>
>
> <cfcomponent
>        displayname="adminBean"
>        output="false"
>        hint="A bean which models the adminBean form.">
>
>
>        <!---
>        PROPERTIES
>        --->
>        <cfset variables.instance = StructNew() />
>
>        <!---
>        INITIALIZATION / CONFIGURATION
>        --->
>        <cffunction name="init" access="public"
> returntype="it.EM.model.adminBean" output="false">
>                <cfargument name="ID" type="NUMERIC" required="false"
> default="0" />
>                <cfargument name="OID" type="STRING" required="false"
> default="" />
>                <cfargument name="EVENT_ID" type="NUMERIC" required="false"
> default="0" />
>                <cfargument name="CREATE_DATE" type="DATE" required="false"
> default="#Now()#" />
>                <cfargument name="CREATED_BY" type="STRING" required="false"
> default="" />
>
>                <!--- run setters --->
>                <cfset setID(arguments.ID) />
>                <cfset setOID(arguments.OID) />
>                <cfset setEVENT_ID(arguments.EVENT_ID) />
>                <cfset setCREATE_DATE(arguments.CREATE_DATE) />
>                <cfset setCREATED_BY(arguments.CREATED_BY) />
>
>                <cfreturn this />
>        </cffunction>
>
>        <!---
>        PUBLIC FUNCTIONS
>        --->
>
>        <cffunction name="getMemento" access="public"returntype="struct"
> output="false" >
>                <cfreturn variables.instance />
>        </cffunction>
>
>        <cffunction name="validate" access="public" returntype="boolean"
> output="false">
>
>       <cfargument name="Errors" type="struct" required="true" />
>
>       <cfset var tempErrors = structNew() />
>
>       <cfif NOT len( trim( getoID() ) ) >
>          <cfset tempErrors['OID'] = "Please enter an OID for this
> ADMIN" />
>       </cfif>
>
>                <cfif structCount( tempErrors ) >
>                        <cfset structAppend( arguments.Errors, tempErrors )
> />
>                        <cfreturn false />
>                <cfelse>
>                        <cfreturn true />
>                </cfif>
>
>        </cffunction>
>
>
>
>        <!---
>        ACCESSORS
>        --->
>        <cffunction name="setID" access="public" returntype="void"
> output="false">
>                <cfargument name="ID" type="NUMERIC" required="true" />
>                <cfset variables.instance.ID = arguments.ID />
>        </cffunction>
>        <cffunction name="getID" access="public" returntype="NUMERIC"
> output="false">
>                <cfreturn variables.instance.ID />
>        </cffunction>
>
>        <cffunction name="setOID" access="public" returntype="void"
> output="false">
>                <cfargument name="OID" type="STRING" required="true" />
>                <cfset variables.instance.OID = arguments.OID />
>        </cffunction>
>        <cffunction name="getOID" access="public" returntype="STRING"
> output="false">
>                <cfreturn variables.instance.OID />
>        </cffunction>
>
>        <cffunction name="setEVENT_ID" access="public" returntype="void"
> output="false">
>                <cfargument name="EVENT_ID" type="NUMERIC" required="true"
> />
>                <cfset variables.instance.EVENT_ID = arguments.EVENT_ID />
>        </cffunction>
>        <cffunction name="getEVENT_ID" access="public" returntype="NUMERIC"
> output="false">
>                <cfreturn variables.instance.EVENT_ID />
>        </cffunction>
>
>        <cffunction name="setCREATE_DATE" access="public" returntype="void"
> output="false">
>                <cfargument name="CREATE_DATE" type="DATE" required="true"
> />
>                <cfset variables.instance.CREATE_DATE =
> arguments.CREATE_DATE />
>        </cffunction>
>        <cffunction name="getCREATE_DATE" access="public" returntype="DATE"
> output="false">
>                <cfreturn variables.instance.CREATE_DATE />
>        </cffunction>
>
>        <cffunction name="setCREATED_BY" access="public" returntype="void"
> output="false">
>                <cfargument name="CREATED_BY" type="STRING" required="true"
> />
>                <cfset variables.instance.CREATED_BY = arguments.CREATED_BY
> />
>        </cffunction>
>        <cffunction name="getCREATED_BY" access="public" returntype="STRING"
> output="false">
>                <cfreturn variables.instance.CREATED_BY />
>        </cffunction>
>
> </cfcomponent>
>
> --
> Model-Glue Sites:
> Home Page: http://www.model-glue.com
> Documentation: http://docs.model-glue.com
> Bug Tracker: http://bugs.model-glue.com
> Blog: http://www.model-glue.com/blog
>
> You received this message because you are subscribed to the Google
> Groups "model-glue" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/model-glue?hl=en




-- 
Plutarch - "The mind is not a vessel to be filled but a fire to be kindled."

-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en

Reply via email to