Что случилось с этим HQL? "Нет типа данных для node" - программирование
Подтвердить что ты не робот

Что случилось с этим HQL? "Нет типа данных для node"

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();

Выглядит хорошо, но результат

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)

Почему? Что не так?

4b9b3361

Ответ 1

Вы не определили псевдоним "gs". У вас есть только "ags" и "tgs".

Ответ 2

когда появилась эта ошибка, вы должны знать, что между словами или переменными не обнаружено опечатки или нет.