我有以下 Grails 域对象
class ProductType {
String name
static hasMany = [attributes: Attribute]
}
class Attribute {
Boolean mandatory = false
Integer seq
static belongsTo = [productType: ProductType]
}
我想获得所有ProductType
s 和他们的强制Attribute
s。此外,我希望被选中Attribute
的 s 被seq
属性急切地加载和排序。我尝试了各种 HQL 和 Criteria 查询,但似乎无法弄清楚。