HTTP 状态 500 - 节点没有数据类型:org.hibernate.hql.internal.ast.tree.IdentNode
HTTP Status 500 - No data type for node: org.hibernate.hql.internal.ast.tree.IdentNode
我知道这个问题已经被问过很多次了。我已经搜索了整个 Stack Overflow,但没能从中得到多少。我知道当查询中使用的列名与 bean class 中指定的 属性 不同时会出现此异常,但是,我的两个参数是相同的。
完成错误:
java.lang.IllegalStateException:节点没有数据类型:org.hibernate.hql.internal.ast.tree.IdentNode
+-[IDENT] IdentNode: 'iduserInfo' {originalText=iduserInfo}
这是我的查询:
List<Object[]> tuples = session.createQuery( "select iduserInfo, SUM(points) from " + persistentClass.getName()
+ " GROUP BY iduserInfo "
+ "ORDER BY SUM(points) DESC").list();
这是我的豆子class:
@XmlRootElement
@Entity
@Table(name = "userInfo")
public class UserInfo {
protected @XmlElement int id;
protected @XmlElement int iduserInfo;
protected @XmlElement int idquestion;
protected @XmlElement String location;
protected @XmlElement String state;
protected @XmlElement String type;
protected @XmlElement Date timestamp;
protected @XmlElement Double latitude;
protected @XmlElement Double longitude;
protected @XmlElement Integer points;
查询针对除 iduserInfo 和 idquestions 之外的所有参数运行。我在 table 中的列名具有完全相同的参数,虽然我在某处读到它并不重要,您只需要将您的参数与 bean classes!
匹配即可
我通过将列名 "iduserInfo" 和 "idquestion" 分别更改为 "user" 和 "question" 解决了这个问题。我认为这样做的原因是已经有一个带有"id"的参数。我不明白为什么这是导致问题的原因,但是将列名称更改为甚至与参数 "id" 不相干的名称对我来说是个窍门!
我知道这个问题已经被问过很多次了。我已经搜索了整个 Stack Overflow,但没能从中得到多少。我知道当查询中使用的列名与 bean class 中指定的 属性 不同时会出现此异常,但是,我的两个参数是相同的。
完成错误:
java.lang.IllegalStateException:节点没有数据类型:org.hibernate.hql.internal.ast.tree.IdentNode +-[IDENT] IdentNode: 'iduserInfo' {originalText=iduserInfo}
这是我的查询:
List<Object[]> tuples = session.createQuery( "select iduserInfo, SUM(points) from " + persistentClass.getName()
+ " GROUP BY iduserInfo "
+ "ORDER BY SUM(points) DESC").list();
这是我的豆子class:
@XmlRootElement
@Entity
@Table(name = "userInfo")
public class UserInfo {
protected @XmlElement int id;
protected @XmlElement int iduserInfo;
protected @XmlElement int idquestion;
protected @XmlElement String location;
protected @XmlElement String state;
protected @XmlElement String type;
protected @XmlElement Date timestamp;
protected @XmlElement Double latitude;
protected @XmlElement Double longitude;
protected @XmlElement Integer points;
查询针对除 iduserInfo 和 idquestions 之外的所有参数运行。我在 table 中的列名具有完全相同的参数,虽然我在某处读到它并不重要,您只需要将您的参数与 bean classes!
匹配即可我通过将列名 "iduserInfo" 和 "idquestion" 分别更改为 "user" 和 "question" 解决了这个问题。我认为这样做的原因是已经有一个带有"id"的参数。我不明白为什么这是导致问题的原因,但是将列名称更改为甚至与参数 "id" 不相干的名称对我来说是个窍门!