![](/img/trans.png)
[英]Grails 2.x createCriteria 'or' doesn't work for nested associations
[英]Grails - createCriteria: associations + not + ilike
一些条件如何:关联+不+ ilike不会给出良好的结果。 我仍然会收到带有结果状态中我不想要的动作的案例。 对其他方法有什么线索或建议吗?
我在控制器中有这个:
def pgp = [:]
pgp.max = params.max?.toInteger() ?: 20;
pgp.offset = params.offset?.toInteger() ?: 0
pgp.max = 20;
def result = Case.createCriteria().list(pgp) {
actions {
not {
and {
ilike("status","%CLOSED")
ilike("status","%Installed in PRD")
}
}
}
}
这是相关的域片段:
class Case {
String caseCode
String caseName
String caseType
static hasMany = [ actions : Action ]
我在Grails 2.4.4上
您的布尔逻辑有误- and
应为or
。 当前的测试对于status
每个可能值都是正确的,因为任何通过ilike("status","%CLOSED")
都将失败ilike("status","%Installed in PRD")
,反之亦然。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.