ColdFusioning: Pronunciation \kold-fy�-zhn-ing\ Noun: The action of one that writes ColdFusion.

ColdFusion ORM: Error while executing the Hibernate query - table is not mapped exception

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:


<cfset request.id = 0 />
<cfscript>
categories = ormExecuteQuery("from categories where ParentID = ?", [request.ID]);
</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:

<cfset request.id = 0 />
<cfscript>
categories = ormExecuteQuery("from Categories where ParentID = ?", [request.ID]);
</cfscript>

The code works. A simple capitalization error that doesn't seem obvious because ColdFusion is largely not case sensitive.



Comments
Brad Wood's Gravatar What database are you using? I assume it was case sensitive?
# Posted By Brad Wood | 10/24/09 2:41 PM
Rupesh Kumar's Gravatar Hibernate query language (HQL) is case sensitive. The entity name and property name used in HQL must be in the same case in which they are specified in the CFC.
# Posted By Rupesh Kumar | 10/26/09 2:36 AM
James Brown's Gravatar This was written using MS SQL but as Rupesh stated, it is HQL that is case sensative and not the database.
# Posted By James Brown | 10/26/09 2:38 AM