0

我的代码

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 为什么会这样,我该如何解决?

4

2 回答 2

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])
于 2013-01-03T14:13:38.547 回答
0

实际上,由于 findAll 方法的类级别访问而出现错误我已经在域中为 findAll 编写了一个静态方法并在控制器中访问该方法然后它起作用了

于 2013-01-09T07:04:45.927 回答