查询HQL查询语法错误

时间:2018-03-08 11:45:37

标签: hql

Hql查询:

Select ecd.consumption from com.dventus.wonchi.jaxb.messages.Wonchi as w 
join w.systemBound as consumption 
join consumption.fixedNetwork as ecd 
where w.meterId = 'DVEHighLowUsageCheck' and ecd.time in (select min(ecd.time))

例外

java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected end of subtree [Select ecd.consumption from com.dventus.wonchi.jaxb.messages.Wonchi as w join w.systemBound as consumption join consumption.fixedNetwork as ecd where w.meterId = 'DVEHighLowUsageCheck' and ecd.time in (select min(ecd.time))]

1 个答案:

答案 0 :(得分:0)

正如@getjackx所指出的,语法不正确。

您需要为子选择FROM添加条款select min(ecd.time),例如:

select min(ecd2.time) FROM FixedNetwork ec2