Note14:SSH框架中hibernate 出现 user i
2017-06-27 本文已影响0人
灰羽_
在做SSH框架整合时,在进行DAO操作时。这里就只调用了chekUser()方法。运行时报
user is not mapped 错误:

调用的方法如下:

上面的语句出错时因为自己写了HQL的语句,其中我写的语句是:from userinfo

但是在HQL语句中表名应该是ORM映射的类名,而不是你在数据库中的表名。而且你的映射文件需要放在一起
所以将HQL语句中的userinfo的表名改为Userinfo即可,

改后如下:
String hql="from Userinfo";

只要将表明换成ORM映射的类名就可以了
在次运行就不会报没有 xxx is not mapped的错了。