@Test @DataSet("BaobaoTao.Users.xls") public void findUserByUserName() { User user = userDao.getUserByUserName("tony"); assertNull("不存在用户名为tony的用户!", user); user = userDao.getUserByUserName("jan"); assertNotNull("Jan用户存在！", user); assertEquals("jan", user.getUserName()); assertEquals("123456",user.getPassword()); assertEquals(10,user.getCredit()); }
public User getUserByUserName(String userName){ List<User> users = (List<User>)getHibernateTemplate().find(GET_USER_BY_USERNAME,userName); if (users.size() == 0) { return null; }else{ return users.get(0); } }
UserDao extends BaseDao<User> { public User getUserByUserName(String userName){ List<User> users = (List<User>)getHibernateTemplate().find(GET_USER_BY_USERNAME,userName); if (users.size() == 0) { return null; }else{ return users.get(0); } } }
UserDao extends BaseDao<User> { public User getUserByUserName(String userName){ List<User> users = (List<User>)getHibernateTemplate().find(GET_USER_BY_USERNAME,userName); if (users.size() == 0) { return null; }else{ return users.get(0); } }  }
UserDao extends BaseDao<User> { public User getUserByUserName(String userName){ List<User> users = (List<User>)getHibernateTemplate().find(GET_USER_BY_USERNAME,userName); if (users.size() == 0) { return null; }else{ return users.get(0); } }  User getUserByUserName(String userName); List<User> queryUserByUserName(String userName); }
UserDao extends BaseDao<User> { public User getUserByUserName(String userName){ List<User> users = (List<User>)getHibernateTemplate().find(GET_USER_BY_USERNAME,userName); if (users.size() == 0) { return null; }else{ return users.get(0); } }  User getUserByUserName(String userName); List<User> queryUserByUserName(String userName);  }