HQL中的意外令牌

时间:2013-08-27 09:30:36

标签: hibernate

这是我的HQL quey。但执行此操作后,发生以下错误。如何解决此问题

错误:意外令牌:d1

select d from DimensionStone d inner join d.stockRegister s where d.stockRegister.stockRegisterId <=? and s.application.applicationId=? 
    and d.isIssued='No' or (s.stockRegisterId <=? and d.isIssued='Yes' and d.issuedDate>(select max(updatedOn) from StockRegister st where st.stockRegisterId<? and st.application.applicationId=?)) and d not in(select d1 from DimensionStone d1 inner join d1.stockRegister s1 where s1.stockRegisterId <=? and s1.application.applicationId=? d1.isIssued='No'

2 个答案:

答案 0 :(得分:0)

and s1.application.applicationId=? d1.isIssued='No'

您遗漏了?d1之间的某些内容,可能是and

答案 1 :(得分:0)

ands1.application.applicationId=?之间添加d1.isIssued='No'

select d from DimensionStone d inner join d.stockRegister s where d.stockRegister.stockRegisterId <=? and s.application.applicationId=? 
and d.isIssued='No' or (s.stockRegisterId <=? and d.isIssued='Yes' and d.issuedDate>(select max(updatedOn) from StockRegister st where st.stockRegisterId<? and st.application.applicationId=?)) and d not in(select d1 from DimensionStone d1 inner join d1.stockRegister s1 where s1.stockRegisterId <=? and s1.application.applicationId=? 
and d1.isIssued='No'