[coldbox-3.6.0] Virtual entity service injection issue

We have an existing ColdBox application that we haven’t been using ORM on, but want to start.

I’ve got the orm example app from the ColdBox site up and running and have changed thethis.ormsettings struct in the application.cfc to include the datasource for my existing app. I then created a persistent cfc and gave it a table name in the component’s properties that matched that of one of the tables in the db. I commented out the other code that referenced the sample ‘Author’ and ‘Book’ stuff and used my new one, called list() on the entityService that is injected and it magically listed all the records from the db table when I run the page in the browser, so I know it’s working.

I then copied the persistent cfc file from the sample app into my existing app we’re trying to overhaul, added the same orm settings in its application.cfc (and the this.ormenabled = true) and added the entityService injection metadata at the top of my app’s handler. I restarted ColdFusion so it would pick up the orm config bits and tried to visit the page and I get an error: Could not find the ColdFusion component or interface <the name of my cfc>.

I’m certain that it’s finding the file and that my cfclocation path in the ormsettings is correct because if I change the entityService injection metadata to reference something bogus (like ‘Foo’), then I get a different error: ‘A CFC with entityname Foo could not be found.’ So I know it’s finding the .cfc file itself.

The stack trace shows that the error is happening in system/orm/hibernate/util/CFORMUtil.cfc on line 69 in the EntityNew() call. Since the file is identical (direct copy/paste) to the one I can get running properly in the sample app I’m strongly suspecting that it’s something at the application level that’s different that causes that EntityNew call to toss out that error. Since EntityNew is a ColdFusion function I can’t really step in and see what’s going wrong or what’s different between the sample app and my app. I did put a throw(message=arguments.entity) just before that line and in both apps the value is the same string (the entity name from the injection metadata).

What I need is some way of investigating what’s going on or tracking down what setting may be affecting the ColdFusion ORM, since it seems to be at that level.

(the above is a paste from the same question over on StackOverflow)

Breakthrough. After beating my head against my desk for a while I came across this: http://forums.adobe.com/thread/834124

This got me thinking about something that’s different between my app and the sample app: this.customTagPaths in my application.cfc is specified and doesn’t include my model folder (my app happens to separate custom tag files in a different folder from my models). After adding the model folder to the list it suddenly started working.

I strongly agree with the OP on the adobe thread that this shouldn’t require something like this that feels like a very hacky workaround; if I specify a value for cfclocation (and if, as I presume from my testing with Foo on the metadata, it can in fact locate the file) then it should Just Work.

I think this isn’t a CB issue, but a basic CF hibernate/orm issue. However it may be worth noting in the CB docs that this is a caveat (if indeed it is).

One other difference that I noted was that I’m bootstrapping CB rather than extending it in my app cfc - I’m guessing that probably doesn’t have any effect on this issue.