service.newCriteria

Hi Gang,
Following the documentation I have the following code for limiting the entities returned:

prc.IncidentInvestigation = ORMService.new();
// Get all the related entities
prc.IncidentReports = IncidentReportService.newCriteria()
	.isNull("incidentClosed").list(asQuery = true)

but it doesn’t work.
I get an the following error:

can't call method [isNull] on object, object is null

Can anyone see what I am doing wrong:?
Thanks!

I’m not quite familiar with cborm, but hopefuly I can point you in the right direction for you to debug further.

I would check first the the definition of the IncidentReportService variable (not showed here), make sure it’s correct.
Based on what I understand, it should be a virtual service. See the examples in the docs :

Hope it helps !

Hi Frank

It is indeed a Virtual Service. I have not coded my own.
I can create a service and have it talk with my models - elsewhere - as long as I am not using the newCriteria() method.

I am not sure if there is an issue with my usage if newCriteria() or if indeed I have stumbled across a bug.

When I posted - I was hoping for an example of how to use the method correctly - (with the assumption that I have misunderstood the current documentation)

Thanks.

Can you post the definition of your IncidentReportService variable ?

It should be something like this if you use injection:

property name="IncidentReportService" inject="entityService:IncidentReport";

or

IncidentReportService = getInstance( dsl="entityService:IncidentReport" );