Why don't Domain class static methods work from inside a grails "service"?

Posted by ????? on Stack Overflow See other posts from Stack Overflow or by ?????
Published on 2010-03-25T21:01:12Z Indexed on 2010/03/25 21:03 UTC
Read the original article Hit count: 279

Filed under:
|
|
|

I want a grails service to be able to access Domain static methods, for queries, etc.

For example, in a controller, I can call

IncomingCall.count()

to get the number of records in table "IncomingCall"

but if I try to do this from inside a service, I get the error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'incomingStatusService': Invocation of init method failed; nested exception is groovy.lang.MissingMethodException: No signature of method: static ms.wdw.tropocontrol.IncomingCall.count() is applicable for argument types: () values: []

How do these methods get injected? There's no magic def statement in a controller that appears to do this. Or is the problem that Hibernate isn't available from my Service class?

© Stack Overflow or respective owner

Related posts about groovy

Related posts about grails