[coldbox-3.5.1] Criteria Builder, .count() working, .get() AND .list() throwing Controller not found

Hi everyone,

I’ve got a weird little error when using a Criteria query.

The function is used to find a Person by their User.id (ie, Person one-to-one User)

The function is in PersonService and is:

public any function getPersonByUserID(required numeric userID)
{
c = newCriteria();

c.createAlias(‘user’,‘user’);
c.and(c.restrictions.eq(‘id’,javacast(“int”,arguments.userID)));
return c.count();
}

In that guise it works fine, and produces a count of 1 for my test.

The error appears when I change .count() to .get() OR .list()

The Error is:

Detail The coldbox main controller has not been initialized
ErrorCode [empty string]
ExtendedInfo [empty string]
Message ColdBox Controller Not Found

My hibernate logging tells me the query is run perfectly, and returns exactly what I expect.

It is called via a test:

function testgetPersonByUserID()
{
result = model.getPersonByUserID(2);

debug(result);
}

Any thoughts on what the problem is?

Cheers
Steve

I am guessing that

debug(result);

is the problem!!

ok, so a silly question… why would that affect whether the coldbox controller is found?
It doesn’t affect anything when the criteria calls .count()

I don’t know Steve, the error message is the remoteproxy.cfc so I am guessing it is that. But as you provide no stack trace it makes it even harder to tell.