Ejemplo n.º 1
0
 public int update(ProductLine productLine, Connection con) throws SQLException {
   try (PreparedStatement prepareStmt = con.prepareStatement(updateProductLine)) {
     prepareStmt.setString(1, productLine.getName());
     prepareStmt.setString(2, productLine.getDescription());
     prepareStmt.setInt(3, productLine.getId());
     return prepareStmt.executeUpdate();
   }
 }
Ejemplo n.º 2
0
  public boolean delete(ProductLine p, Connection con) throws SQLException {
    ModuleDAO mDao = new ModuleDAO();

    for (Module m : p.getModules()) {
      mDao.delete(m, con);
    }

    try (PreparedStatement prepStatement = con.prepareStatement(remove)) {
      prepStatement.setLong(1, p.getId());
      return prepStatement.execute();
    }
  }