SSH关于通过User登录user is not mapped [from user where userName=? and password=?]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: user is not mapped [from user where userName=? and password=?]

看图

user is not mapped [from user where userName=? and password=?]; nested exception is org.hibernate.hq
查看dao中的代码

List<User> list= find("from user where userName=? and password=?",new String[]{userName, password});
        return list.get(0);

这里的from user 这个user代表表明 ,这样是不可以的

下面正确写法将user换成User 。from是针对User这个类,而不是这个表user:

List<User> list= find("from Userwhere userName=? and password=?",new String[]{userName, password});
        return list.get(0);

Lucas科技:
csdn博客:https://blog.csdn.net/qq_43084651
github:https://github.com/LLLLucas/-

相关文章:

  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-10-08
  • 2021-10-23
猜你喜欢
  • 2021-10-12
  • 2018-04-21
  • 2021-11-13
  • 2021-06-13
  • 2021-04-29
  • 2021-07-15
  • 2021-07-30
相关资源
相似解决方案