Boa tarde galera, tenho um DAO que retor uma lista caso tenha resultado. Mas não está retornando. chega no if() e fala que é falso.rs.next()
public static ArrayList<Users> listMember(){
try{
SQLConnection.connect();
String sql = "select * from user where authority in(?????)";
pstmt = SQLConnection.getConnection().prepareStatement(sql);
pstmt.setString(1, "ROLE_PRES");
pstmt.setString(2, "ROLE_RH");
pstmt.setString(3, "ROLE_PROJ");
pstmt.setString(4, "ROLE_MARK");
pstmt.setString(5, "ROLE_FINA");
rs = pstmt.executeQuery();
if(rs.next()){
listMember = new ArrayList<Users>();
do{
user = new Users();
user.setAuthority(formatRole(rs.getString("authority")));
user.setEmail(rs.getString("email"));
user.setUsername(rs.getString("username"));
user.setLastName(rs.getString("lastName"));
user.setName(rs.getString("name"));
user.setOccupation(rs.getString("occupation"));
user.setPhotoPath(rs.getString("photoPath"));
user.setProject(rs.getString("project"));
listMember.add(user);
}while(rs.next());
}
pstmt.close();
rs.close();
SQLConnection.destroyConnection();
return listMember;
}catch(Exception e){
e.printStackTrace();
return null;
}
}
OBS: fiz o a query no terminal e retornou o resultado desejado.
Quem puder ajudar, ficarei muito grato.
