您的位置:首页 > 移动开发

Hibernate报错(user is not mapped)

2016-06-19 15:15 477 查看
使用Hibernate框架时,输入hql语句需要注意

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

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

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

此处会报错(user is not mapped)

将其改为:就可以了

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

表名、字段名要和映射文件一致,而不是跟数据库表名、字段名一致
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: