日期:2014-05-17 浏览次数:20706 次
public class UserDao extends BaseDao implements IUserDao {
@Override
public User1 validateUser(String username, String password) {
System.out.println(username+" xx "+password);
// TODO Auto-generated method stub
String sql="FROM USER1 U WHERE U.USERNAME=? AND U.PASSWORD=?";
Session session=getSession();
Query query=session.createSQLQuery(sql);//
query.setParameter(0, username);
query.setParameter(1, password);
List<User1> users=query.list();
if(users.size()!=0)
{
User1 user=(User1)users.get(0);
return user;
}
session.close();
return null;
}
}
String sql="SELECT * FROM USER1 U WHERE U.USERNAME=? AND U.PASSWORD=?";