我正在尝试在两个嵌套对象上使用带有OR的createCriteria。
这是我正在使用的代码:
or {
ordersSecondaryReceptionSystem {
eq('code', params.receptionSystemCode)
}
ordersReceptionSystem {
eq('code', params.receptionSystemCode)
}
}
只有两个中的一个被考虑在内,次要的一个。有什么我想念的吗?
我能够通过创建别名来修复它:
createAlias('ordersReceptionSystem', 'ordersReceptionSystem', Criteria.LEFT_JOIN)
createAlias('ordersSecondaryReceptionSystem', 'ordersSecondaryReceptionSystem', Criteria.LEFT_JOIN)
or {
eq('ordersReceptionSystem.code', params.receptionSystemCode)
eq('ordersSecondaryReceptionSystem.code', params.receptionSystemCode)
}