Cannot get HQL queries to work in CB 3.1

I have the latest stable release of Coldbox, and am trying to use the findAll() method. I keep getting the same error after trying several different queries.

This works (returns an array of Member objects):
rc.members = ormService.getAll(entityName = “Member”);

rc.members = ormService.list(“Member”);

but this does not:

rc.members = ormService.getAll(entityName = “Member”);

rc.members = ormService.findAll(“from Member”);

I get the following error:
Error Messages: Error while executing the Hibernate query.
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: Member near line 1, column 6 [from Member]


coldfusion.orm.hibernate.HibernatePersistenceManager$QueryExecuteException: Error while executing the Hibernate query.

	at coldfusion.orm.hibernate.HibernatePersistenceManager.executeHQL(HibernatePersistenceManager.java:742)
	at coldfusion.orm.hibernate.HibernatePersistenceManager.executeQueryWithNamedParams(HibernatePersistenceManager.java:630)
	at coldfusion.orm.ORMUtils._executeQuery(ORMUtils.java:291)
	at coldfusion.orm.ORMUtils.executeQuery(ORMUtils.java:281) 
... and so on.

Hmm, not sure, on that one, can you post eh hql it builds

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Sure, but I’m not entirely sure how to do that…

Hmm, not sure if Member is a keyword in HQL.
Try "from [Member]

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Yep, Member is an HQL keyword. Changing Member.cfc to Memberz.cfc or Memb.cfc works just fine. This is not ideal though, as I might run into more entities named the same as HQL keywords.

I’ve tried your suggestion for escaping Member, but still got the same error:
unexpected token: [Member] near line 1

I also tried single quotes, curly braces, backslashes and model.Member (with all the escaping variations), and nothing seemed to work, other than to change the name of the CFC.

You think this might be a bug in CF ORM?

Maybe this is your answer?

https://hibernate.onjira.com/browse/HHH-3811