Can anyone else confirm that getting a dictionary causes the schema to be
requeried?
Doug
On Tue, Apr 22, 2008 at 11:17 AM, Ali Syed <[EMAIL PROTECTED]> wrote:
> I had the same experience while working with MG Unity and Reactor. The
> database schema was being queried every time I did an insert or an update
> even though everything was set to production. So to narrow things down I
> took MG out of the equation and wrote a simple test just with reactor. It
> seems like if you validate the record using the validate() method before you
> do the insert or update the DB schema is queried otherwise its not. I am
> using Reactor version 429 with coldfusion MX7 and SQL Server 2005.
>
> After a lot of looking around I tracked this down to line 186 of
> reactor.core.objectFactory
>
> <cfset var dictionaryXmlPath =
> "#getObject(arguments.alias).getMapping()#/Dictionary/#arguments.alias#dictionary.xml"
> />
>
> The call to getObject seems to generate the query to the database schema
>
> I changed the above line to the following
>
> <cfset var tempmapping = "/" & Replace(getMapping(), ".", "/", "all") />
> <cfset var dictionaryXmlPath =
> "#tempmapping#/Dictionary/#arguments.alias#dictionary.xml" />
>
> and that seems to have solved the issue. I am no where near a Reactor
> expert. I have used it for a couple of months so I wanted to share this with
> everyone so that they can take a look and see what they think about this.
>
> The test code I used is as follows.
>
> <cfsilent>
> <cfapplication name="testapp" sessionmanagement="true"/>
> <cfif not structKeyExists(application,'reactor') or isDefined("url.init")>
> <cfset application.reactor = CreateObject("Component",
> "reactor.reactorFactory").init(expandPath("reactor.xml")) />
> </cfif>
> </cfsilent>
>
> My reactor configuration file is as follows
> <reactor>
> <config>
> <project value="testapp" />
> <dsn value="testdsn" />
> <type value="mssql" />
> <mapping value="/testapp/data" />
> <mode value="production" />
> </config>
>
> <objects>
> <object name="Post">
> <hasMany name="Comment">
> <relate from="PostId" to="PostId" />
> </hasMany>
> </object>
> </objects>
> </reactor>
>
> And finally the code that I am using to test this
> <cfset record = application.reactor.createRecord("Post")>
> <cfset record.setPost("Post is going to be the post text ")>
> <cfset record.setTitle("This is the post title")>
> <!--if you remove validate database schema is not queried-->
> <cfset record.validate()>
> <cfset record.save()>
>
>
> Ali
>
>
> >>> "Doug Hughes" <[EMAIL PROTECTED]> 4/22/2008 8:46 AM >>>
> Did you use the reactor configuration that comes with MG's CS.xml? Or did
> you provide your own?
>
> Also - I've had embarasing experiances where the application itself was
> reloading.... someone decided to clear the application scope in the
> application.cfm for testing purposes and then checked that code in to our
> repo.... thus the application was always reloading. I'd check to make
> sure
> that's not the case.
>
> But, it does sound to me like reactor is in development mode (even if
> model-glue is in production).
>
> Doug
>
> On Tue, Apr 22, 2008 at 8:54 AM, Adam Cameron <[EMAIL PROTECTED]>
> wrote:
>
> > To me it sounds like MG is set to reload on each request. You want MG
> not
> > > to reload or rescaffold and you want reactor in production mode.
> > >
> >
> > Hi Doug.
> >
> > I have this in my ColdSpring.xml file:
> >
> > {code}
> > <property name="reload"><value>false</value></property>
> > <!-- Rescaffold is overridden by reload - if reload is false,
> rescaffold's
> > setting doesn't matter -->
> > <property name="rescaffold"><value>false</value></property>
> > {code}
> >
> > There's nothing either way specifically in ModelGlue.xml (my
> understanding
> > being that this responsibility is taken over by ColdSpring.xml in the
> latest
> > version of M-G).
> >
> > One variation from the installation guidelines I have is that my
> /reactor
> > mapping is not set in CF, but is done in Application.cfc. And I have
> the
> > mapping because I've got the reactor dir in a different dir:
> > [base]/com/alagad/Reactor (the CF and site webroot are
> [base]/PhotoGallery;
> > I'm using the inbuilt web server for this). Could this be an issue? I
> > would expect if there was any problems with said approach I'd be getting
> far
> > more serious issues than what I'm seeing (ie: I'd expect it not to work
> at
> > all), so presume it's OK.
> >
> > As per previous, I reckon people shouldn't spend too much time on this @
> > present as I'll set up some test rigs this evening in a more controlled
> > environment, and have a mess around. I might be able to sort it out
> myself.
> >
> > That said, I do appreciate the suggestions: I'd just hate for you lot to
> > be spending more time on this than I can, at present. If you know what
> I
> > mean.
> >
> > Cheers.
> >
> >
> > --
> > Adam
> >
> >
> >
> >
> >
> >
> > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> --
> > -- --
> > Reactor for ColdFusion Mailing List
> > [EMAIL PROTECTED]
> > Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
> > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> --
> > -- --
> >
> >
>
>
> --
> Doug Hughes, President
> Alagad Inc.
> [EMAIL PROTECTED]
> 888 Alagad4 (x3)
> Office: 919-550-0755
> Fax: 888-248-7836
>
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- --
> Reactor for ColdFusion Mailing List
> [EMAIL PROTECTED]
> Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- --
>
> --- Scanned by eMail Protection Services---
>
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- --
> Reactor for ColdFusion Mailing List
> [EMAIL PROTECTED]
> Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- --
>
>
--
Doug Hughes, President
Alagad Inc.
[EMAIL PROTECTED]
888 Alagad4 (x3)
Office: 919-550-0755
Fax: 888-248-7836
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --