日期:2014-05-17 浏览次数:20794 次
public User checkUser(final User user){ return (User) getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { // TODO Auto-generated method stub Query query = session.createQuery("from User where username = ? and password = ?"); query.setString(0, user.getUsername()); query.setString(1, user.getPassword()); return query.uniqueResult(); } }); }