I'm starting to learn ORM and figured I'd post some simple but confusing problems I've run into. The first is I kept getting the error:
Error while executing the Hibernate query.
org.hibernate.hql.ast.QuerySyntaxException: tablename is not mapped
This was my ORM code:
ColdFISH is developed by Jason Delmore. Source code and license information available at coldfish.riaforge.org
<cfset request.id = 0 />
<cfscript>
categories = ormExecuteQuery("from categories where ParentID = ?", [request.ID]);
</cfscript>
1<cfset request.id = 0 />
2<cfscript>
3categories = ormExecuteQuery("from categories where ParentID = ?", [request.ID]);
4</cfscript>
Apparently, because my cfc is named Categories.cfc and I didn't capitalize "categories" inside of the ormExecuteQuery, it was throwing the error. If I cahnge it to:
ColdFISH is developed by Jason Delmore. Source code and license information available at coldfish.riaforge.org
<cfset request.id = 0 />
<cfscript>
categories = ormExecuteQuery("from Categories where ParentID = ?", [request.ID]);
</cfscript>
1<cfset request.id = 0 />
2<cfscript>
3categories = ormExecuteQuery("from Categories where ParentID = ?", [request.ID]);
4</cfscript>
The code works. A simple capitalization error that doesn't seem obvious because ColdFusion is largely not case sensitive.
Comments