gpt4 book ai didi

java - 节点 : org. hibernate.hql.internal.ast.tree.IdentNode HQL 没有数据类型

转载 作者:IT老高 更新时间:2023-10-28 20:55:16 30 4
gpt4 key购买 nike

我有 HQL,我试图在其中获取没有分类的工件(当 Activity 为 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]);

每次运行都会出错

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

分类定义:

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"
}
}

你可以引用我之前遇到的问题来了解我到底想要做什么Quest 1Quest 2

最佳答案

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

SELECT artifactId FROM Classification

关于java - 节点 : org. hibernate.hql.internal.ast.tree.IdentNode HQL 没有数据类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26471534/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com