当前位置: 代码迷 >> Java相关 >> lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException:
  详细解决方案

lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException:

热度:6621   发布时间:2013-02-25 21:52:12.0
hql 错误 unexpected token: (
碰见了个问题,求大家帮忙解决

2011-03-03 14:52:00 [STDOUT]-[INFO]-[152] ________hql = from is_static t,(select max(s.st_checkmark) checkmark,s.st_loginid from is_static s where s.st_loginid in (select m.ma_pid from is_machine m where 1=1 ) group by s.st_loginid ) a where t.st_loginid = a.st_loginid and t.st_checkmark = a.checkmark 

2011-03-03 14:52:00 [PARSER]-[ERROR]-[33] line 1:18: unexpected token: (

2011-03-03 14:52:00 [WorkConditionManagerCommand]-[INFO]-[1789] java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: ( near line 1, column 18 [from is_static t,(select max(s.st_checkmark) checkmark,s.st_loginid from is_static s where s.st_loginid in (select m.ma_pid from is_machine m where 1=1 ) group by s.st_loginid ) a where t.st_loginid = a.st_loginid and t.st_checkmark = a.checkmark ]

sql里面可以执行,但是这里报"("问题!!


------解决方案--------------------------------------------------------
hql里from后面跟的是对象名,不是表名。
------解决方案--------------------------------------------------------
hql语句里面表名都是反转实体名以及对应实体属性名称
  相关解决方案