hi I'm uploading an excel file to jsp to save it in MySQL the excel file has two fields type date, at the time of reading the respective file I get this error java.util.Date can not be cast to java .sql.Date when executing it and I could not solve it, someone knows how I can fix this I upload the code where I am reading the excel file, the cases where I evaluate the two fields type date are 3 and 4 I do not know how you can evaluate in this part either
for (int i = 1; i <= firstsheet.getLastRowNum(); i++) {
fila = firstsheet.getRow(i);
No = new TablaNovedadEmpleado();
No.setFecha(fecha);
int j = 0;
for (j = 0; j < fila.getLastCellNum(); j++) {
Cell celda = fila.getCell(j);
if (j == 0) {
if (celda == null || celda.getCellType() == Cell.CELL_TYPE_BLANK) {
break;
}
}
switch (j) {
case 1:
if (celda.getCellType() == Cell.CELL_TYPE_STRING) {
No.setNombres(celda.getStringCellValue());
}
break;
case 2:
if (celda.getCellType() == Cell.CELL_TYPE_STRING) {
No.setTipo_Novedad(celda.getStringCellValue());
}
break;
case 3:
if (celda.getCellType() == Cell.CELL_TYPE_NUMERIC) {
No.setFecha_inicio((Date) celda.getDateCellValue());
}
break;
case 4:
if (celda.getCellType() == Cell.CELL_TYPE_FORMULA) {
No.setFecha_fin((Date) celda.getDateCellValue());
}
break;
case 5:
if (celda.getCellType() == Cell.CELL_TYPE_NUMERIC) {
No.setDias(celda.getStringCellValue());
}
break;
case 6:
if (celda.getCellType() == Cell.CELL_TYPE_NUMERIC) {
No.setHoras(celda.getStringCellValue());
}
break;
}
}
if (No.getNombres() != null) {
lst.add(No);
//guardarArchivoNoveddades(No);
}
}
Collections.sort(lst, TablaNovedadEmpleado.comparet);