[coldbox 3.8.0] OrmService list(asQuery=true) error

I have this object Category.cfc


component extends=“coldbox.system.orm.hibernate.BaseORMService” persistent=“true” table=“category” {

property name=“categoryId” generator=“identity” fieldtype=“id”;
property name=“parent” column=“parentId” fieldtype=“many-to-one” CFC=“category” fkcolumn=“parentId”;
property name=“lft” column=“leftId” type=“numeric”;
property name=“rgt” column=“rightId” type=“numeric”;
property name=“name” ormtype=“string” length=“255”;
property name=“description” ormtype=“text”;

// Constructor
function init(){
return this;



this object is in a module.

When I try to get a list of category with


property name=“ormService” inject=“entityService:Category”;

rc.CategoryList = ormService.newCriteria().list(entityName=“Category”,asQuery=true);


I got this error:


Application Execution ExceptionError Type: database : 0

Error Messages: invalid parameter for query, ambiguous column name
columnNames: categoryId,lft,rgt,name,description


If I use

rc.CategoryList = ormService.newCriteria().list(entityName=“Category”,asQuery=false);


I got an array of category. Why I cannot get the categorylist as query object?

I’m on railo 4.1

Hi Francesco–

I googled this error, and found a number of complaints about this coming from people who started seeing this error after upgrading to Railo 4 from 3. Others might have some solutions, but in the meantime you might check these threads to see if they shed any light on the issue:



Also, just curious, but what happens if you remove the parent property and then ormreload and try again?

I’ve removed parent property but got same error. However I would add that if the table is empty, I get an empty query object, but if I insert a record I got the error.

Probably the error is on



If i remove that line all works great.

Actually, I don’t think you want to extend coldbox.system.orm.hibernate.BaseORMService on an orm entity.
Were you thinking of coldbox.system.hibernate.ActiveEntity instead?

Ah, I didn’t even notice that :slight_smile:

Happy it’s working now!

To be honest I was trying a solution as stated on this blog post: http://www.andyscott.id.au/blog/coldfusion-and-coldbox-creating-and-using-nested-sets-with-orm

Nice to see so many find that post useful, as it stands I haven’t done much work on this and will revisit it again soon. I was actually converting phpBB at the time over to a ColdBox application for fun, didn’t get very far, but this was one of the things that phpBB uses for its forums.

When I began this, I looked at converting a java snippet over and as that uses ORM Events that ColdFusion doesn’t have like pre/postFlush which a lot of this code should have been using. Anyway I raised this with adobe 3-4 years ago and still waiting for these ORM Events to be available to ColdFusion.

In the meantime, make sure you do a Flush() any time you update the lft and rgt columns, which is pretty much every request. The downside at the moment is that level of caching goes out the window. Otherwise these values will get out of sync with each other.