unexpected token: * 解决办法

02:13:01,413 ERROR [PARSER] line 1:8: unexpected token: *
02:13:01,417 ERROR [STDERR] java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: * near line 1, column 8 [select * from com.kingfish.ejb.beans.Sms s where s.username=?1 order by sendtime desc]
......

......

......

02:13:01,423 ERROR [STDERR] Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: * near line 1, column 8 [select * from com.kingfish.ejb.beans.Sms s where s.username=?1 order by sendtime desc]

 

原因是JPQL和SQL语句混合使用了,其中把*改成对象s就好了 select s from Sms s where s.username=?1 order by sendtime desc

HQL跟JPQL差不多,所以也会出现这种问题,记下,引以为戒....

你可能感兴趣的:(异常备忘)