session.createQuery("Select attribute from GoodsSection tgs " +
"join gs.ascendants ags join ags.attributes attribute " +
"where attribute.outerId = :outerId and tgs = :section ")
.setString("outerId", pOuterId)
.setEntity("section", section)
.setMaxResults(1)
.uniqueResult();
Looks fine to me, but the result is
看起来很好,但结果是
java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.IdentNode
\-[IDENT] IdentNode: 'attribute' {originalText=attribute}
at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:145)
at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:705)
at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:529)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:645)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
Why? What's wrong?
为什么?怎么了?
2 个解决方案
#1
76
You haven't defined the "gs" alias. You only have "ags" and "tgs".
您尚未定义“gs”别名。你只有“ags”和“tgs”。
#2
-1
when this error appeared, you should know that there are the typo or no space between words or variables not found.
当出现此错误时,您应该知道在找不到的单词或变量之间存在拼写错误或没有空格。
#1
76
You haven't defined the "gs" alias. You only have "ags" and "tgs".
您尚未定义“gs”别名。你只有“ags”和“tgs”。
#2
-1
when this error appeared, you should know that there are the typo or no space between words or variables not found.
当出现此错误时,您应该知道在找不到的单词或变量之间存在拼写错误或没有空格。