Coldfusion ORM issue mapping not found when server restarts
Copy link to clipboard
Copied
Windows 2012, CF11, IIS
First, I have the following in my application.cfc:
this.ormenabled=true;
this.ormsettings.dbcreate = "update";
this.ormsettings.flushAtRequestEnd = false;
this.ormsettings.cfclocation=expandpath('/model'); // I've also tried "C:\full\path\model"
My models are in my /model folder.
My error:
Error while executing the Hibernate query.org.hibernate.hql.internal.ast.QuerySyntaxException:
List is not mapped [ from List where listtypeid = 2 and user.userid = ? ] The specific sequence of files included or processed is:
C:\inetpub\vhosts\xxxx\xxxx\sms\index.cfm, line: 7 "
SMS/index.cfm:
<Cfquery name="lists" dbtype="hql">
from List
where listtypeid = 2
and user.userid = <cfqueryparam cfsqltype="cf_sql_integer" value="#session.userid#">
</Cfquery>
I have a few calls prior to the cfquery dbtype=hql using entityloadbypk() such as
<cfset user=entityloadbypk("User",session.userid)>
that work fine.
The wierd thing is to fix it... if I go to my models/List.cfc file... add a blank anywhere in the file and save it, and then do an ORMReload(), it comes up with no problem.
It only happens after the CF service gets restarted.
Any suggestions?
Copy link to clipboard
Copied
ifSteve - I've had the same problem recently and can concurr that the entityload etc works fine unless you do a HQL then it breaks.
I wrote this function which I call as part of my applications setup which basically tests a very basic HQL and if it fails it restarts the Application.
<cffunction name="testConnection" hint="I make sure ORM has been correctly initiated">
<cftry>
<cfquery name="local.prospects" dbtype="hql">
from quote
where 0 = 1
</cfquery>
<cfcatch type="any">
<cfset applicationStop()>
<cflocation url="#cgi.script_name#?#cgi.query_string#" addtoken="no" statuscode="302">
</cfcatch>
</cftry>
</cffunction>
Hope it helps!

