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

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

解决办法:

1.看是否忘记将hibernate的映射文件添加到Hibernate.cfg.xml(使用Hibernate时)或者applicationContext.xml中

2.检查表中的字段和映射文件中的字段是否一一对应

3.检查字段名是否使用了数据库中的关键字

4.例如:

下面的Hql语句

from User

其中的user不是表的名字,而是实体类的类名