Hibernate报错(user is not mapped)

来源:互联网 发布:传奇霸业魂珠活动数据 编辑:程序博客网 时间:2024/06/14 16:07

使用Hibernate框架时,输入hql语句需要注意

      表名是hbm的类名,跟数据库没有关系

  如hql="from user where username=? and password=?";

 user为数据库中的表名,hbm类名为User,

此处会报错(user is not mapped)

将其改为:就可以了

hql="from User where username=? and password=?";


表名、字段名要和映射文件一致,而不是跟数据库表名、字段名一致

0 0
原创粉丝点击