今天在写hql语句的时候出现了这个错误,然后一直运行到执行hql这儿就出错了。页面报500.
原hql如下:
String hql = "from SecWilldosetdate where name = 'secEduplan'";
问题如下:
org.hibernate.QueryException: Unable to resolve path [SecWilldosetdate.name], unexpected token [SecWilldosetdate] [from com.sms.security.supervisionAssess.bean.SecWilldosetdate where SecWilldosetdate.name = 'secEduplan'] org.hibernate.hql.ast.tree.IdentNode.resolveAsNakedComponentPropertyRefLHS(IdentNode.java:219)
折腾了好一会,最后加了个别名好了,不知道是什么原因。还是对hql不熟悉啊。
String hql = "from SecWilldosetdate s where s.name = 'secEduplan'";