org.hibernate.hql.ast.QuerySyntaxException: INVOICE is not mapped [from INVOICE]

转载 2016年06月01日 14:36:03

使用hibernate的hql语句报错:


org.hibernate.hql.ast.QuerySyntaxException: INVOICE is not mapped [from INVOICE]


原因比较简单,只要在实体类中增加映射注释-实体和表的映射 

@Entity(name = "表名")


1有问题的

@Entity
@SuppressWarnings("serial")
@Table(name = "INVOICE")
public class Invoice implements java.io.Serializable {

2正常的

@Entity(name = "INVOICE")
@SuppressWarnings("serial")
@Table(name = "INVOICE")
public class Invoice implements java.io.Serializable {


但是,涉及到多表查询的时候hql查询就无效了,这个时候报这种错误就只能更换为sql语句了



相关文章推荐

org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User] 异常总结

异常如下:org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User]  at org.hibernate.h...

org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped [from XX]

org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped [from XX] 解决办法: 1.看是否忘记将hibernate的映射文...

org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User] 异常总结

异常如下:org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User] at org.hibernate.hq...

org.hibernate.hql.internal.ast.QuerySyntaxException: userinfo is not mapped [from userinfo u where u

org.hibernate.hql.internal.ast.QuerySyntaxException:userinfo is not mapped [from userinfo u where u....

org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped [from XX]

http://669341085.iteye.com/blog/858572 org.hibernate.hql.ast.QuerySyntaxException: XX is not mapped...

org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User] 异常总结

异常如下: org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User] at org.hibernate....

nested exception is org.hibernate.hql.ast.QuerySyntaxException: users is not mapped. [from users]

在使用hibernate时,出现了以上异常:

Hibernate异常: org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User]

Hibernate异常:org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User]1、出现该错误的情况分析1,...

org.hibernate.hql.ast.QuerySyntaxException: is not mapped 异常总结

org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [select u from User u where u.userNam...

org.hibernate.hql.internal.ast.QuerySyntaxException: ### is not mapped

这个异常是hql语句写错了,hibernate中的hql不是sql,区别在于from后面的表名不是数据库中的表名,是实体类名字。完整的异常报告:严重: Servlet.service() for se...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)