org.hibernate.hql.ast.QuerySyntaxException: user is not 地图ped 错误

org.hibernate.hql.ast.QuerySyntaxException: user is not mapped 异常
org.hibernate.hql.ast.QuerySyntaxException: user is not mapped [from user]1、hibernate.cfg.xml少了很多映射.为什么会少呢?因为我的都是拷贝过来的。不是自动生成的。另外 hibernate.cfg.xml,要放在根目录下。
把你要映射的都写上去。
<mapping resource="....包名.../Companyinfo.hbm.xml" />
<mapping resource="....包名.../Companyinfo.hbm.xml" />
<mapping resource="....包名.../Companyinfo.hbm.xml" />
<mapping resource="....包名.../Companyinfo.hbm.xml" />
<mapping resource="....包名.../Companyinfo.hbm.xml" />
2、现象:
使用hql="from person" 出现" person is not mapped " 错误配置文件如下:
<hibernate-mapping>
<class name="src.Person"
table="person">
<id name="name"/><property name="password"/>
</class>
</hibernate-mapping>
原 因:
hql是写的是PO对象,不是table名故改为配置文件中的红色部分的类名即可。

我出现的是第二种情况,记录一下。