用hql查询时报语法错误,本人把hql改为sql之后,在mysql工具上查,可以成功查询到记录。问一下高手本人的hql语法哪儿有错,跪求指点,困扰一天了。
下面是hql
select d.taskId, s2.name, d.triggerTime, d.startTime, d.endTime, d.state, d.cycle, d.expectTime
from SchTaskDetail d,
SchTask s2
where d.taskId = s2.id and d.id in (
select c1.id
from SchTaskDetail c1,
(select t1.taskId,max(t1.updateTime) updateTime
from SchTaskDetail t1
where 1=1 and t1.startTime >= "2015-01-04 12:23:12" and t1.endTime <= "2016-01-04 12:23:12"
group by t1.taskId) d1
where c1.taskId = d1.taskId and c1.updateTime = d1.updateTime )
order by d.triggerTime asc
这是sql
select
d.task_id,
s2.name,
d.trigger_time,
d.start_time,
d.end_time,
d.state,
d.expect_time
from
etldb.sch_task_detail d,
etldb.sch_task s2
where
d.task_id = s2.id
and d.id in (select
c1.id
from
etldb.sch_task_detail c1,
(select
t1.task_id, max(t1.update_time) update_time
from
etldb.sch_task_detail t1
where
1 = 1 and t1.start_time >= "2015-01-04 12:23:12"
and t1.end_time <= "2016-01-04 12:23:12"
group by t1.task_id) d1
where
c1.task_id = d1.task_id
and c1.update_time = d1.update_time)
order by d.trigger_time asc
hibernate程序中报错 :org.hibernate.hql.ast.QuerySyntaxException: unexpected token: