There's a way to handle this validation ?
class java.lang.Integer cannot be cast to class java.lang.String
Code:
private List<Map<String,String>> getEmpRegistry(
List<Map<String,String>> tblObjRowsList,
Integer rowNumber
){
List<Map<String,String>> empRegistry = new ArrayList<>();
for (Map<String,String> empR : tblObjRowsList){
if (empR.get("id").equals(rowNumber)){
empRegistry.add(empR);
}
}
return empRegistry;
}
Looks wrong, because I can't compare String and Integer.
But for some reason tblObjRowsList is extracted from stored procedure in MySQL via Spring Data:
@Query(value="CALL SP_ObjsRowDetails2(:Id,:templateId,:strMode)",nativeQuery = true)
List<Map<String,String>> getRowDetail (@PathParam("Id") Integer id,
@PathParam("templateId") Integer templateId,
@PathParam("strMode") Integer strMode);
Extract the data like this:
I tried:
Integer.parseInt(empR.get("id")).equals(rowNumber)
Integer.parseInt(empR.get("id").toString()).equals(rowNumber)
empR.get("id").toString().equals(String.valueOf(rowNumber))
And the most interesting thing is:
Doesn't make sense, if the source variable is Map<String,String>

