java.lang.IllegalArgumentException: node to traverse cannot be null!

报错信息:

java.lang.IllegalArgumentException: node to traverse cannot be null!
 at org.hibernate.hql.ast.util.NodeTraverser.traverseDepthFirst(NodeTraverser.java:31)
 at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:254)
 at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
 at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
 at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
 at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
 at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
 at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
 at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
 at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
 at com.cqa.core.common.dao.EntityDaoImpl.findPage(EntityDaoImpl.java:154)
 at com.cqa.service.vip.znx.ZnxServiceImpl.findMemberMail(ZnxServiceImpl.java:10)
 at com.cqa.service.vip.znx.ZnxServiceImpl$$FastClassByCGLIB$$b3302b8d.invoke()
 at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
 at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:714)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:162)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
 at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:652)
 at com.cqa.service.vip.znx.ZnxServiceImpl$$EnhancerByCGLIB$$6bde40b5.findMemberMail()
 at com.cqa.action.vip.znx.VipZnxAction.loadMemberMail(VipZnxAction.java:41)
 at com.cqa.action.vip.znx.VipZnxAction.show(VipZnxAction.java:23)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)

解决方法:

      通常此类错误都是由于HQL语句写的不正确,例如from写成了form,或者set A = 1 and B = 2,其中set不同字段用逗号","分离而不是用and.总之仔细检查HQL语句,看看有没有语法错误即可.


上一篇:linux 休眠唤醒


下一篇:hibernate 一对多 关系关联映射