SQL翻译成HQL 问题
SQL如下:
select t.* from licence_stock t where t.out_organ_id = '101'
and (select max(tt.operate_count) from licence_stock tt where t.licence_oid=tt.licence_oid )
= (select ttt.operate_count from licence_stock ttt where t.licence_oid=ttt.licence_oid and ttt.out_organ_id='101')
t.licence_oid是LicenceInfo的属性(主键),LicenceInfo是LicenceStock的属性
我翻译的HQL执行不通过:
select stock from licenceStock stock inner join fetch stock.licenceInfo info and stock.operateCount=(
select max(stock1.operateCount) from LicenceStock stock1 inner join fetch stock1.licenceInfo info1
where info.id=info1.id)
这里关键的问题是info能否出现在子查询中
高手指教。。。。。。。。