HQL语句中的表名是javabean的类名

来源:互联网 发布:金税盘开票软件界面 编辑:程序博客网 时间:2024/05/18 13:10
Hibernate错误集:
"from Users where username='"+username+"'and password='"+password+"'" 中的Users为hbm.xml中class配置的name属性的类名即javabean类名,若有错误便会报

users is not mapped [from users where username='h' and password='j'] 这样的错

且where后面的字符串变量的值必须要加单引号,否则会报错
javabean 中有有参构造时,千万要记得把无参构造写进去,不然无参构造就被覆盖了,ssh框架读取javabean要用到无参构造,所以会出错。
0 0