public int createAll(ProductLine productLine, Connection connection) throws ClassNotFoundException, SQLException { ModuleDAO moduleDao = new ModuleDAO(); int plId = this.save(productLine, connection); productLine.setId(plId); moduleDao.createAll(productLine.getModules(), connection); return plId; }
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(); } }