Modifying CRUD handlers

Today, I downloaded the Coldbox Utilities 2.6. I was able to get the
crud methods working. In the Anchors handler I wanted to modify the
index event to this and got this:

rc.Anchors = ormService.executeQuery("select anchor_name from
anchors"); I get this error Error while executing the Hibernate query.
org.hibernate.hql.ast.QuerySyntaxException: anchors is not mapped
[select anchor_name from anchors]

It works fine with this.
rc.Anchors = ormService.getAll();

if you are doing direct HQL make sure your entity names are case sensitive.

Luis F. Majano
President
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

Hi Luis, is there anyway for me to dump the entity names to see what
the case should be on Anchors.
I have tried several variations and same error.

hmm, usually the name of the CFC or inside the CFC component you can say entity="" and give it a name

Luis F. Majano
President
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

Hi Luis, that did it inside my Anchor model component I added
entityname="Anchors"
Now I am trying this
rc.Anchors = ormService.executeQuery("select distinct ANCHOR_NAME from
Anchors");
Now I get this error
Can not convert the given object to query.

hmm, not sure on that george, I guess these are the intricacies of HQL maybe.

Luis F. Majano
President
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

Hi Luis, I am not really certain why this is not working. I have tried
many different things to be able to filter what columns are returned
to me.
This absolutely works.
rc.id = 2;
rc.Anchors = ormService.executeQuery("from Anchors as Z where
Z.PROPERTYID = ?", [rc.id], true);
This does not
rc.id = 2;
rc.Anchors = ormService.executeQuery("select Z.ANCHOR_IMAGE,
Z.ANCHOR_NAME from Anchors as Z where Z.PROPERTYID = ?", [rc.id],
true);

Is there some setting somewhere that needs to be turned on which is
not?

Thanks!

Not that I know of. I would suggest turning on logging for hibernate and starting up Coldfusion via a console so you can see all the debugging messages.

Luis Majano
President
Ortus Solutions, Corp
Toll free phone/fax: 1-888-557-8057
Mobile: 909-248-3408

www.coldbox.org