public Employee findByUsernameAndPassword(Employee employee) {
String hql = "from Employee where username = ? and password = ?";
List<Employee> list = this.getHibernateTemplate().find(hql,employee.getUsername(),employee.getPassword());
if(list.size()>0) {
return list.get(0);
}
return null;
}
異常:
2017-09-26 11:03:49 [?????ˉ] Exception occurred during processing request: null
java.lang.NullPointerException
at cc.test.employee.dao.impl.EmployeeDaoImpl.findByUsernameAndPassword(EmployeeDaoImpl.java:18)
5 回答

呼如林
TA貢獻(xiàn)1798條經(jīng)驗(yàn) 獲得超3個(gè)贊
調(diào)用this.getHibernateTemplate() 報(bào)空指針異常了或者 employee 為null了。
添加回答
舉報(bào)
0/150
提交
取消