我可以从该域类中调用该域类上的findAll
吗?
class MyClass {
Parents parent
///...
def onLoad(){
MyClass.findAll('from MyClass where parent:=parent',[parent:parent]);
}
}
当我尝试时,我得到一个没有签名的方法findAll可用于MyClass错误。
最佳答案
我认为您的问题不是从域类中调用findAll
。
您似乎遇到了一些语法问题...
您可能想要的是:
MyClass.findAll('from MyClass m where m.parent=:parent', [parent:parent])
findAll documentation
要么
MyClass.findAllByParent(parent)
findAllBy documentation
关于grails - Grails在域类中使用findAll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30247015/