HQL 代码敲完 然后执行查询的方法
package com.muke.dao.Impl; import java.util.List; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import com.muke.dao.sshDao; import com.muke.domain.User; public class sshDaoImpl extends HibernateDaoSupport implements sshDao { @Override public boolean verify(User user) { String hql="from user where username= ? and pwd= ? "; List<User> list=this.getHibernateTemplate().find(hql, user.getUsername(),user.getPwd()); if(list.size()>0){ return list.size()>0; }else{ return false; } } }
我的也是500错误,org.springframework.orm.hibernate3.HibernateQueryException: Expected positional parameter count: 2, actual parameters: [com.employee.entity.Employee@6350ed68] [from Department where username = ? and password = ?]; nested exception is org.hibernate.QueryException: Expected positional parameter count: 2, actual parameters: [com.employee.entity.Employee@6350ed68] [from Department where username = ? and password = ?],这是什么原因?
已经决解了原来 HQL 语句哪里的from 后面的不是表明 而是实体类类名