尝试在域中查找空值时,grails方法缺少异常

马特·韦斯特莱克

根据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] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章