我的代码
def baseRecordList = DealerBaseInfo.findAll("from DealerBaseInfo as dealers",[cache: false])
在PriorApprovalController.groovy
groovy.lang.MissingMethodException: No signature of method: DealerBaseInfo.findAll() is applicable for argument types: () values: []
Possible solutions: findAll(), findAll(), findAll(groovy.lang.Closure), findAll(java.lang.Object), findAll(java.lang.String), findAll(groovy.lang.Closure)
at DealerBaseInfo.findAll(DealerBaseInfo.groovy)
at DealerBaseInfo$findAll.call(Unknown Source)
PriorApprovalController.<init>(PriorApprovalController.groovy:37)
... 42 more
| Error Exception occurred trigger event [TestPhasesEnd]: Could not create a new instance of class [PriorApprovalController]!`
grails版本为2.1.1,代码覆盖率为1.2.5 为什么这样,我该如何解决?
答案 0 :(得分:0)
查看findAll()支持的签名:http://grails.org/doc/2.1.0/ref/Domain%20Classes/findAll.html
要使用queryParams,我认为你应该这样做:
def baseRecordList = DealerBaseInfo.findAll("from DealerBaseInfo as dealers", [], [cache: false])
答案 1 :(得分:0)
实际上错误来了,因为findAll方法的类级别访问我在域中为findAll编写了一个静态方法,然后在控制器中访问该方法然后它工作了