根据grails的文档(位于http://grails.github.io/grails-doc/latest/guide/GORM.html#finders),
Category.findAllByParentCategoryIsNull()
是查找ParentCategory为null的类别的正确方法。
这是我的类别域名课程
class Category {
String name
Category parentCategory
static constraints = {
name unique:true
parentCategory nullable:true
}
}
由于某种原因,我遇到了一个缺少方法的异常
Caused by MissingMethodException: No signature of method: static groovy.lang.Category.findAllByParentCategoryIsNull() is applicable for argument types: () values: []
groovy.lang.Category
被引用,而不是Category
将在不同程序包中的Domain类。
在使用该类的类中更正该程序包Catergory
将解决此问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句