过去几天我一直在尝试将此sql转换为命名查询并失败。这是sql
select * from EACI ci
LEFT OUTER JOIN EAT eat
ON ci.user_id = eat.user_id
WHERE ci.commodity_code = eat.commodity_code and ci.auditor_type <> eat.auditor_type and eat.IS_LATEST ='Y'
EACI和EAT不是直接加入,而是通过另一个表User
加入 @NamedQuery(
name = "ACI.findMismatch",
query = "select aci from AuditorCommodityInfo aci "
+ " inner join aci.user user "
+ " inner join fetch user.auditorTrackings tracking "
+ " WHERE tracking.isLatest= 'Y'"
+ " and aci.auditorType <> tracking.auditorType "
+ " and aci.commodity.code = tracking.commodity.code "
)
我在这里做错了什么?