Well, the problem is: I do not capture the value that exists in the database, especially in field codsubmenu
, it is only capturing null values. I leave the code.
public class Menu implements Serializable{
private int idMenu;
private Menu codsubmenu;
public int getIdMenu() {
return idMenu;
}
public void setIdMenu(int idMenu) {
this.idMenu = idMenu;
}
public Menu getCodsubmenu() {
return codsubmenu;
}
public void setCodsubmenu(Menu codsubmenu) {
this.codsubmenu = codsubmenu;
}
while(rs.next()){
Menu menu=new Menu();
menu.setIdMenu(rs.getInt("idMenu")); //en esta línea si me captura el id del menu
// me captura null
menu.setCodsubmenu(menu.getCodsubmenu());
}
}
However, when you change the last line to:
menu.setCodsubmenu(rs.getInt("codsubmenu"));
I underline the error in this way
incompatible types: int cannot be converted to Menu**