@Override
	public void deleteIngredient(int i) {
		Ingredient ingredient = getIngredient(i);
		for(int parent : ingredient.getParentIngredients()){
			for(Ingredient child : getChildrenIngredients(ingredient)){
				child.addParent(parent);
				updateIngredient(child);
			}
		}
		try(Connection connection = DriverManager.getConnection(connectionString)){
			PreparedStatement statement = connection.prepareStatement("delete from ingredient where id = ?");
			statement.setInt(1, i);
			statement.executeUpdate();
			statement = connection.prepareStatement("delete from parent where idParent = ? or idIngredient = ?");
			statement.setInt(1, i);
			statement.setInt(2, i);
			statement.executeUpdate();
		}
		catch(SQLException ex){
			ex.printStackTrace();
		}
	}