Question

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 the this.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.

Was it helpful?

Solution

Yeah, apparently it has to do with customTagPaths in your application.cfc

Why? I'm not sure. I'm sure there's a CF dev at Adobe that probably knows the answer.

For a full explanation, see the response here: https://groups.google.com/forum/?fromgroups#!topic/coldbox/dFMG5PB6wn4

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top