gpt4 book ai didi

grails - 如何在Grails Gorm中查询3个表

转载 作者:行者123 更新时间:2023-12-02 15:40:52 28 4
gpt4 key购买 nike

我是grails框架的新手,如何查询3个表之间的关联

    Class A{
static hasMany = [b:B]
}

enter code here

class B{
long aId // Id of table A
}

class c{
B b //B reference
}

SQL查询:从B中的b的id中选择*(从B中的a的id ='10'_中选择ID)
Any help will be appreciated.

最佳答案

直截了当

def list = C.withCriteria{
b{
eq 'aId', '10'
}
}

关于grails - 如何在Grails Gorm中查询3个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61137368/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com