Chris

With this code I am, for the first time, able to reproduce the problem with
just Reactor and no Model Glue.

I was looking at exactly the code you referred to in your message just
before I went home last night. I was tracing through trying to find the
problem in Model Glue. However, after reading your message I got an idea for
a short cut.

You only need to modify the top two or three lines of this code after you
cut and paste it into a test.cfm to see the problem.

For me there there are two calls to readFields every time createDictionary()
is called.

Thanks very much for taking the time to look at this. Your discovery gave me
the idea to try this.

Bryan


<!---MODIFY THESE THREE LINES TO MATCH YOUR SYSTEM--->
<cfset yourTableName = "Widget">
<cfset yourColdspringXmlPath = "/mgbasic/config/ColdSpring.xml">
<cfset yourColdspringPath = "coldspring.beans.DefaultXmlBeanFactory">

<!--- Create the coldspring bean factory --->
<cfset variables.instance.ColdSpringBeanFactory =
createObject("component","#yourColdspringPath#").init() />
<cffunction name="getColdSpring" access="public" returntype="any"
output="false">
   <cfreturn variables.instance.ColdSpringBeanFactory />
</cffunction>

<!--- Read the xml file --->
<cfset getColdSpring().loadBeansFromXmlFile("#yourColdspringXmlPath#",true)
/>

<!--- get the Reactor bean based on the definition in the xml file --->
<cfset variables.instance.Reactor = getColdSpring().getBean("Reactor") />
<cffunction name="getReactor" access="public" returntype="any"
output="false">
   <cfreturn variables.instance.Reactor />
</cffunction>

<cfset session.readFieldsCounter = 0>
readFieldsCounterORIG=<cfdump var="#session.readFieldsCounter#" label="
session.readFieldsCounter"><br>

<cfset YourObject = getReactor().createRecord("#yourTableName#")>

<cfset dict = getReactor().createDictionary("Widget") />
readFieldsCounterTWO=<cfdump var="#session.readFieldsCounter#" label="
session.readFieldsCounter"><br>

<cfset dict = getReactor().createDictionary("Widget") />
readFieldsCounterTHREE=<cfdump var="#session.readFieldsCounter#" label="
session.readFieldsCounter"><br>

<cfset dict = getReactor().createDictionary("Widget") />
readFieldsCounterFOUR=<cfdump var="#session.readFieldsCounter#" label="
session.readFieldsCounter"><br>



On 5/14/07, Chris Blackwell <[EMAIL PROTECTED]> wrote:

 Bryan,

I was digging around in an attempt to reply to your post on the MG list
and i think i may have come up with the cause of you're problem, i'll try
and explain what i found, so bare with me...

I generated a scaffold for a table using the modelglueapplicationtemplate,
and commented out the redirect result for the scaffold so i could inspect
the readField count after the end of the commit.  With reactor in
development mode i saw 18 readFields calls, with it in production i saw 3.
I thought that by setting MG reload to false this would drop to zero, but it
didn't, it was still making 3 calls.

So i added a <cfthrow> to ObjectDAO.cfc just before the qFields query and
had a look down the stack trace. It seems that readFields is being called by
ModelGlue.unity.orm.ReactorAdapter

57    <cfset var dict = getReactor().createDictionary(arguments.table) />

I haven't had looked into this thoroughly as its getting quite late now,
but it seems that whilst most create methods will call readFields in
production mode and cache the results, creating a dictionary will always
result in a call to readFields.  I've tested this outside MG and you still
get calls to readFields even when a valid dictionary.xml has been created,
reactor is in production mode and stored in a persistent scope.

I hope that gets you closer to figuring this out, as i'm quite confused
now :)

cheers, chris



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

Reply via email to