Hibernate 用GORM单向分组

Hibernate 用GORM单向分组,hibernate,grails,gorm,Hibernate,Grails,Gorm,我有一对相当常见的模型: class Parent { static hasMany = [children: Child] } class Child { String someProperty } 现在我要做的是按Child.someProperty执行一个group,但我在View上并没有太成功 在控制器中,我可以执行以下操作: def children = parentInstance.children.groupBy{child -> child.somePr

我有一对相当常见的模型:

class Parent {
    static hasMany = [children: Child]
}

class Child {
    String someProperty
}
现在我要做的是按Child.someProperty执行一个group,但我在View上并没有太成功

在控制器中,我可以执行以下操作:

def children = parentInstance.children.groupBy{child -> child.someProperty}

我试图实现的是递归地在每个
someProperty

下显示子对象,我最终解决了自己的问题。我简化了功能,只需向父模型添加一个方法,以返回所有具有相对父id的子模型或按所需属性排序的实例