This afternoon I encountered an error ‘A CFC with entityname X could not be found’ as I was working on a new campaign entity for our Adwords campaign. For GCA.net, we are preparing to launch a AdWord campaign related to the new RedHat JBoss Bootcamp Training classes that are almost public. We also happen to be in the middle of the SugarCRM release to the Sales staff which is causing lots of interruptions.
I was interupted as I was adding a new property to the campaign.cfc entity and lost my train of thought. After returning to work I had a mysterious error that could not be correct.
A CFC with entityname campaign could not be found. error was produced by the following code:
Campaign = entityload('gca.model.entities.campaign',{campaignID=1},true)
After verifying the entity was there and all my ORM settings were unchanged I was puzzeled. I finally created a new entity using the new operator:
Campaign = new gca.model.entities.campaign();
This is where I discovered I actually had a duplicate property name in the Campaign entity and recalled my interruption and loss of concentration.
So, if you are getting a mysterious error in ColdFusion9 that your entity mapping can not be found you may have a syntax or logic issue in your entity that is preventing ColdFusion from generating the .class file for your ORM entity. The order of creation vs. the order of validation is just a little odd in this case.
Hope this help some poor Googler trying to figure out what is wrong.