节点没有数据类型:org.hibernate.hql.internal.ast.tree.IdentNode HQL [英] No data type for node: org.hibernate.hql.internal.ast.tree.IdentNode HQL

查看:1097
本文介绍了节点没有数据类型:org.hibernate.hql.internal.ast.tree.IdentNode HQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  artifacts = Artifact 

我有HQL,我试图获得没有分类的工件(当active为0时) .findAll(FROM Artifact WHERE id NOT IN(SELECT artifact_id FROM Classification WHERE active = 1)AND document_id =:docid,[docid:document.id],[max:limit,offset:startIndex]);

每当我运行时,我都会收到错误

  java.lang.IllegalStateException:节点没有数据类型:org.hibernate.hql.internal.ast.tree.IdentNode 
\- [IDENT] IdentNode:'artifact_id' {originalText = artifact_id}

分类定义:

< $ p $ class $ class $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $' $ b TaxonomyNode节点
字符串artifactId
布尔活动
字符串createdBy
字符串updatedBy
日期dateCreated
日期lastUpdated


static constraints = {
node nullable:false,blank:false
artifactId nullable:false,blank:false,unique:['node']
active可空:false,空:false
createdBy可为空:false,空白:false
updatedBy可空:false,b lank:false
}

static mapping = {
id generator:'sequence',params:[sequence:'classification_seq']
artifactId index:'classify_by_artifact_node'
节点索引:'classify_by_artifact_node'
active defaultValue:1
}
}

您可以参考我以前遇到的问题,以了解我正在尝试做什么 Quest 1 Quest 2

解决方案

SQL查询使用列名称,而HQL查询使用Class属性。您正在从Classification中选择artifact_id,但Classification类没有名为artifact_id的属性。要修复它,请在HQL中使用类属性。

  SELECT artifactId FROM分类


I have the HQL where I trying to get artifacts that have no classification (when active is 0)

artifacts = Artifact.findAll("FROM Artifact WHERE id NOT IN ( SELECT artifact_id FROM Classification WHERE active = 1) AND document_id = :docid",[docid:document.id], [max:limit, offset:startIndex]);

Whenever I run I get the error

java.lang.IllegalStateException: No data type for node: org.hibernate.hql.internal.ast.tree.IdentNode 
 \-[IDENT] IdentNode: 'artifact_id' {originalText=artifact_id}

Classificaiton definition:

class Classification {

    public static final String USER_DEFAULT = "USER"
    public static final String USER_SYSTEM = "SYSTEM"

    TaxonomyNode node
    String artifactId 
    Boolean active
    String createdBy
    String updatedBy
    Date dateCreated
    Date lastUpdated


    static constraints = {
        node nullable:false, blank:false
        artifactId nullable:false, blank:false, unique: ['node']
        active nullable: false, blank: false
        createdBy nullable:false, blank:false
        updatedBy nullable:false, blank:false
    }

    static mapping = {
        id generator:'sequence', params:[sequence:'classification_seq']
        artifactId index: 'classify_by_artifact_node'
        node index: 'classify_by_artifact_node'
        active defaultValue: "1"
    }
}

You can refer to previous problems I faced to understand what exactly I am trying to do Quest 1 and Quest 2

解决方案

SQL queries use column names while HQL queries use Class properties. You're selecting artifact_id from Classification but the Classification class has no property named 'artifact_id'. To fix it, use the class property in your HQL.

SELECT artifactId FROM Classification

这篇关于节点没有数据类型:org.hibernate.hql.internal.ast.tree.IdentNode HQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆