使用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语句了