@Override public Object getAsObject(FacesContext contex, UIComponent component, String obj) { Telefone t = null; if (obj.length() == 12) { t = new Telefone(); t.setDdd(Integer.parseInt(obj.substring(1, 3))); t.setNumero(Integer.parseInt(obj.substring(4, 12))); } return t; }
public static void main(String args[]) { List<Telefone> lista; // = new LinkedList<>(); TelefoneDAO dao = new TelefoneDAO(); Telefone aaa = new Telefone(); aaa.setDdd(38); aaa.setNumero(123); try { lista = dao.ListarTodos(1); dao.Salvar(aaa, 1); System.out.print(lista); } catch (SQLException ex) { Logger.getLogger(Teste.class.getName()).log(Level.SEVERE, null, ex); } }