O servelet não salva

Pessoal estou migrando de PHP para Java, estou fazendo uma aplicação na unha para poder dominar a linguagem, criei a classe estrutura, o DAO , e quando eu faço um teste chamando por uma classe principal funciona perfeitamente insere, altera tudo ok, mais quando uso o servelet, não insere , ele instancia a classe corretamente mais nâo insere. olha o codigo

a classe

public class BancoR10 {
private int idbancoR10;
private String descricao;
private String cod;
public BancoR10() {
}
public int getIdbancoR10() {
return idbancoR10;
}
public void setIdbancoR10(int idbancoR10) {
this.idbancoR10 = idbancoR10;
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
public String getCod() {
return cod;
}

public void setCod(String cod) {
    this.cod = cod;
}

@Override
public int hashCode() {
    int hash = 5;
    hash = 61 * hash + this.idbancoR10;
    return hash;
}
@Override
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final BancoR10 other = (BancoR10) obj;
    if (this.idbancoR10 != other.idbancoR10) {
        return false;
    }
    return true;
}

}

classe DAO
*

  • To change this license header, choose License Headers in Project Properties.
  • To change this template file, choose Tools | Templates
  • and open the template in the editor.
    */
    ackage org.seced.dao.parametro;

mport java.sql.Connection;
mport java.sql.PreparedStatement;
mport java.sql.ResultSet;
mport java.sql.SQLException;
mport java.sql.Statement;
mport org.seced.bd.Conect;
mport org.seced.bd.Crud;
mport org.seced.estrutura.parametro.BancoR10;
mport java.util.logging.Level;
mport java.util.logging.Logger;

**
*

  • @author Zenilton
    */
    ublic class BancoR10DAO {

    Connection con;
    Crud sql = new Crud();

    public BancoR10DAO() {
    sql.setTable(“bancor10”);
    con = Conect.getConnection();
    }

    public int add(BancoR10 R10) {
    int id = 0;
    try {
    sql.setField(“descricao,cod”);
    sql.setValue("?,?");
    con.setAutoCommit(false);
    PreparedStatement ps = con.prepareStatement(sql.insert());
    ps.setString(1, R10.getDescricao());
    ps.setString(2, R10.getCod());
    ps.executeUpdate();
    //recuperando chave do registro inserido
    /* ResultSet retornoDoID = ps.getGeneratedKeys();
    retornoDoID.next();
    id = retornoDoID.getInt(1);*/
    //==========================================
    con.commit();
    con.close();
    } catch (Exception ex) {
    System.out.println(“Ocorreu erro”);

     }finally{try {
             con.close();
         } catch (SQLException ex1) {
             Logger.getLogger(BancoR10DAO.class.getName()).log(Level.SEVERE, null, ex1);
         }}
     return id;
    

    }

    public void edit(BancoR10 R10) {
    try {
    sql.setField("descricao=?,cod=? ");
    sql.setWhere(“idbancoR10=?”);
    con.setAutoCommit(false);
    PreparedStatement ps = this.con.prepareStatement(sql.update());
    ps.setString(1, R10.getDescricao());
    ps.setString(2, R10.getCod());
    ps.setInt(3, R10.getIdbancoR10());
    ps.executeUpdate();

         con.commit();
         con.close();
     } catch (Exception ex) {
         System.out.println("Ocorreu erro");
         try {
             con.close();
         } catch (SQLException ex1) {
             Logger.getLogger(BancoR10DAO.class.getName()).log(Level.SEVERE, null, ex1);
         }
     }
    

    }

    public void del(BancoR10 R10) {
    try {
    sql.setWhere(“idbancoR10=?”);
    con.setAutoCommit(false);
    PreparedStatement ps = con.prepareStatement(sql.delete());
    ps.setInt(1, R10.getIdbancoR10());
    ps.executeUpdate();
    con.commit();
    } catch (Exception ex) {

     }finally{try {
             con.close();
         } catch (SQLException ex1) {
             Logger.getLogger(BancoR10DAO.class.getName()).log(Level.SEVERE, null, ex1);
         }}
    

    }

// fim da classe

o servelet tanto no doGat como em doPost não salva
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
BancoR10 R10 = new BancoR10();
BancoR10DAO R10DAO = new BancoR10DAO();

    String action = null;
    int retorno = 0;
    int idbancoR10 = 0;
    String descricao = null;
    String cod = null;
    try {
        action = request.getParameter("action");

        descricao = request.getParameter("descricao");
        cod = request.getParameter("cod");

        R10.setDescricao(descricao);
        R10.setCod(cod);
        if (action.equals("add")) {
            retorno = R10DAO.add(R10);
        }

        if (action.equals("edit")) {
            R10.setIdbancoR10(5);
            R10DAO.edit(R10);
        }

    } catch (Exception e) {
        retorno = 100;
    }

    try (PrintWriter out = response.getWriter()) {
        /* TODO output your page here. You may use following sample code. */
        out.println(retorno);
    }

}

aqui em teste salva perfeitamente

public class teste {

public static void main(String[] args) {
   BancoR10 R10 = new BancoR10();
    BancoR10DAO R10DAO = new BancoR10DAO();
   
   R10.setDescricao("Sudameris");
   R10.setCod("weiui");
   System.out.println( R10DAO.add(R10));
    }

}