Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Grails:如何对嵌入式对象使用executeQuery_Grails_Hql - Fatal编程技术网

Grails:如何对嵌入式对象使用executeQuery

Grails:如何对嵌入式对象使用executeQuery,grails,hql,Grails,Hql,我有一个嵌入子对象的对象: class Parent { Child child static embedded ['child'] } class Child { String name } 我想使用executeQuery(因为在我的实际情况中,我不能使用Where查询或create条件)。如何在不切换到标准的情况下做到这一点?试试: Parent.executeQuery("FROM Parent parent WHERE parent.child.name

我有一个嵌入子对象的对象:

class Parent {
    Child child

    static embedded  ['child']
}

class Child {
    String name
}
我想使用executeQuery(因为在我的实际情况中,我不能使用Where查询或create条件)。如何在不切换到标准的情况下做到这一点?

试试:

Parent.executeQuery("FROM Parent parent WHERE parent.child.name = 'FOO'")
编辑:

刚刚注意到,您需要为嵌入式对象添加一个静态声明:

static embedded  ['child']

也许这样就可以了……

是的,这是我原来的帖子中的一个错误,我会改正的