日期:2014-05-20 浏览次数:20954 次
public boolean check(String name,String password) {
SessionFactory sessionFactory = HibernateSessionFactory
.getSessionFactory();
Session session = sessionFactory.openSession();
//Transaction transaction=session.beginTransaction();
String hql1 = "from Hr_User hrUser where hrUser.username=? and hrUser.userpassword=?";
Query query = session.createQuery(hql1).setString(0, name).setString(1, password);
List<Hr_User> list = query.list();
if (list.size() > 0) {
session.close();
return true;
} else {
session.close();
return false;
}
}
public String hr_userLogin() {
bool=hrUserDAO.check(name,password);
if(bool==true){
return SUCCESS;
} else {
return INPUT;
}
}