FW/1 Plugin ORM Issues

45 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Seth Johnson

ungelesen,
03.04.2015, 00:46:2403.04.15
an mura-cms-...@googlegroups.com
Hi All,

I am adding some features to a FW/1 ORM app that runs as a plugin inside of Mura.  Lately I have been seeing some weird ORM errors and then when I run ORMReload() I get "Association References Unmapped Class".  

I can clear the error by going into CFAdmin and clearing the template cache, then OrmReload() works fine.  Rather than continuing to have this problem I decided to set saveMapping = true so that I could try to see why this was happening in the .hbxml files.

What I first noticed was that setting saveMapping=true in my plugin's app.cfc didn't work.  I had to change the setting in applicationSettings.cfm file.  After I got the .hbxml files generated I noticed something strange.

Some of the files have this: 

 <class entity-name="feetype" lazy="true"
        name="cfc:muraWRM.plugins.AMS.model.beans.feetype" table="feetypes">

and some others (in the same "beans" folder") have this:

 <class entity-name="contact" lazy="true"
        name="cfc:AMS.model.beans.contact" table="contacts">

AMS is the name of the plugin.

I don't understand why this is happening, or if it matters.  I really just want to solve the stability issues of this app and I'm wondering if I may be onto something here?

Thanks for any insight you may have.

Seth


Cameron Childress

ungelesen,
03.04.2015, 09:08:1403.04.15
an mura-cms-...@googlegroups.com
On Fri, Apr 3, 2015 at 12:46 AM, Seth Johnson wrote:
Some of the files have this: 

 <class entity-name="feetype" lazy="true"
        name="cfc:muraWRM.plugins.AMS.model.beans.feetype" table="feetypes">

and some others (in the same "beans" folder") have this:

 <class entity-name="contact" lazy="true"
        name="cfc:AMS.model.beans.contact" table="contacts">

Seth - 

I've seen this behavior before and don't think this is a Mura problem so much as a ColdFusion problem. When ORM is first loaded, CF will walk through all your ORM objects and map them out. Depending on some condition that I have never been able to track down - sometimes CF will "discover" the ORM object using it's full pathname and sometimes it will "discover" it using a shorter name. 

I don't think I've seen this problem on Railo though, so I do think this is a CF specific bug. 

The solution for me was to ALWAYS specify the longest fully qualified name for your CFCs to make sure that CF always calls them the same thing internally.

1) This means putting it into the component definition:
<cfcomponent entityName = 'full.path.to.Contact'>

2) Putting it in any return types like inits:
public full.path.to.Contact function init() { return this;
}

3) Calling it that way in the entity*() functions:
entityLoad('full.path.to.Contact');

4) FK relationships also need the fully qualified name:
property fieldtype='many-to-one' cfc='full.path.to.Contact' [...];

After doing this everywhere in my app, my problem went away.

-Cameron
 
--
Cameron Childress
--
p:   678.637.5072
im: cameroncf

Seth Johnson

ungelesen,
03.04.2015, 09:50:4103.04.15
an mura-cms-...@googlegroups.com
Thanks Cameron, I'll give that a shot.  I also typically use Railo and haven't seen this problem with their implementation of Hibernate.  This particular client is on ACF and these ORM errors have been driving me crazy.  

Thanks again!

Seth

--
You received this message because you are subscribed to the Google Groups "Mura CMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mura-cms-develo...@googlegroups.com.
To post to this group, send email to mura-cms-...@googlegroups.com.
Visit this group at http://groups.google.com/group/mura-cms-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/mura-cms-developers/CADBt%2BB0ixOMs8i9e%2BiGdC32i-bLp47eg40e1tDxf32%3DL4B47PA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Seth Johnson

ungelesen,
15.04.2015, 17:29:4715.04.15
an mura-cms-...@googlegroups.com
FYI, this worked for me. With that said, we also moved to CF11.

Thanks!

Seth
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten