Java 节点没有数据类型:org.hibernate.hql.internal.ast.tree.IdentNode hql
在HQL中,我尝试获取没有分类的工件(活动为0时) 每当我运行时,都会出现错误Java 节点没有数据类型:org.hibernate.hql.internal.ast.tree.IdentNode hql,java,hibernate,grails,hql,Java,Hibernate,Grails,Hql,在HQL中,我尝试获取没有分类的工件(活动为0时) 每当我运行时,都会出现错误 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 st
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"
}
}
您可以参考我之前遇到的问题来了解我到底在做什么,并且SQL查询使用列名,而HQL查询使用类属性。您正在从分类中选择artifact\u id,但分类类没有名为'artifact\u id'的属性。要修复它,请在HQL中使用class属性
SELECT artifactId FROM Classification
当DTO(数据传输对象)缺少关键字“new”时,有时会出现这种情况。查看分类定义会有所帮助
SELECT artifactId FROM Classification