百科知识

在SSH中hibernate报错(在线等待)这个类发生异常:$P

2010-11-16 20:20:24A***
这个类发生异常:$Proxy0这个方法发生了异常:login方法参数[0]:entity.Excep ():usersisnotmapped[fromuserswherename=?andpassword=?]org.hibernate.hql.ast.QuerySyntax [fromuserswherename=?andpassword=?]主要报错去上DAO中login方法publicUserslogin(Usersusers)throwsSQLException,DataAccessException,HibernateException{//TODOAuto-generatedmethodstubSystem.out.println("DAo连接前");Queryquery=this.getSession().createQuery("fromuserswherename=?andpassword=?");query.setString(0,users.getName());query.setString(1,users.getPassword());Objectobj=query.uniqueResult();System.out.println("DAo连接后");if(obj!=null){return(Users)obj;}returnnull;}在SSH中hibernate报错(在线等待)这个类发生异常:$Proxy0这个方法发生了异常:login方法参数[0]:entity.Excep():users?

最佳回答

  • users is not mapped users这个表没有被映射,看下Hibernate的配置吧
    2010-11-17 11:36:15
  • "from users where name=? and password=?" users是表名吗,没有写错?
    2010-11-16 20:59:01
  • 很赞哦! (160)