Exception Report node to traverse cannot be null! The server encountered an unexpected condition

Type Exception Report
Message node to traverse cannot be null!
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
java.lang.IllegalArgumentException: node to traverse cannot be null!
org.hibernate.hql.internal.ast.util.NodeTraverser.traverseDepthFirst(NodeTraverser.java:46)
org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:284)
org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:187)
org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:142)
org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:115)
org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:76)
org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:150)
org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:302)

使用泛型写dao层的时候,出现了错误

Exception Report node to traverse cannot be null! The server encountered an unexpected condition_第1张图片

错误的原因是from 和clazz.getName() 中间应该存在一个空格 否则生成的的HQL语句就会连到一起。
"from "+clazz.getName();注意空格

你可能感兴趣的:(其他)