while(resultSet.next()){
if (supportPaging == false && pageNo>0) {
count++;
if(count > rowsPerPage){
break;
}
}
ggUserGradeDto = new GgUserGradeDto();
ggUserGradeDto.setId(dbManager.getLong(resultSet,"Id"));
ggUserGradeDto.setUsercode(dbManager.getString(resultSet,"Usercode"));
ggUserGradeDto.setGradecode(dbManager.getString(resultSet,"Gradecode"));
ggUserGradeDto.setInvaliddate(dbManager.getDateTime(resultSet,DateTime.YEAR_TO_DAY,"Invaliddate"));
ggUserGradeDto.setCreatorcode(dbManager.getString(resultSet,"Creatorcode"));
ggUserGradeDto.setCreatetime(dbManager.getDateTime(resultSet,DateTime.YEAR_TO_DAY,"Createtime"));
ggUserGradeDto.setUpdatercode(dbManager.getString(resultSet,"Updatercode"));
ggUserGradeDto.setValidind(dbManager.getString(resultSet,"Validind"));
ggUserGradeDto.setRemark(dbManager.getString(resultSet,"Remark"));
ggUserGradeDto.setFlag(dbManager.getString(resultSet,"Flag"));
ggUserGradeDto.setUpdatetime(dbManager.getDateTime(resultSet,DateTime.YEAR_TO_DAY,"Updatetime"));
collection.add(ggUserGradeDto);
}
resultSet.close();
return collection;
}
Mysql数据库中总共有两行记录Gradecode 都有值,分别是1,28,类型是varchar(100),从数据库用ResultSet取出的时候,取28时有值,取1的时候为空字符串,不知道怎么回事!
其他的值都set进去了出来了
然后你赋值给了程序中的某个对象,像游标一样,一行一行的赋值
但是后一行赋值将前一行赋值覆盖掉了,就误认为只取得了后一行的28
您的程序中的对象,然后分配给像光标所在行的行分配
但是之后他的党的错误分配覆盖以前的线路分配,只有实现了后一排28