private int insert(Funcionario f) {
        Connection con = null;
        PreparedStatement pstm = null;
        int retorno = -1;
        try {
            con = ConnectionFactory.getConnection();
            pstm = con.prepareStatement(INSERT, Statement.RETURN_GENERATED_KEYS);


            pstm.setString(1, f.getNome());
            pstm.setInt(2, f.getIdade());
            pstm.setString(3, f.getSexo());
            pstm.setDate(4, new java.sql.Date(f.getDataNascimento().getTime()));
            pstm.setString(5, f.getRg());
            pstm.setString(6, f.getCpf());
            pstm.setString(7, f.getTelefone());
            pstm.setInt(8, f.getEndereco().getCodigo());
            pstm.setDouble(9, f.getSalario());
            pstm.setString(10, f.getCargo());
            pstm.setString(11, f.getLogin());
            pstm.setString(12, f.getSenha());

            pstm.execute();

            try (ResultSet rs =
                    pstm.getGeneratedKeys()) {
                if (rs.next()) {
                    retorno = rs.getInt(1);
                }
            }

        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "Erro ao inserir: " + e);
        } finally {
            try {
                ConnectionFactory.closeConnection(con, pstm);
            } catch (SQLException ex) {
            }
            return retorno;
        }
    }