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

Please check out my new site: http://ja.mesbrown.com/

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:

view plain print about
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:
view plain print about
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.

TweetBacks

Comments

What database are you using? I assume it was case sensitive?

# Posted By Brad Wood | 10/24/09 2:41 PM

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

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

Thanks! This was the most helpful blog / comment trail I found on the exception.

# Posted By Aaron Greenlee | 10/27/10 2:59 AM

Recent Comments

RSS

Subscribe