@Override
	public List<Ingredient> getAllIngredients() {
		try (Connection connection = DriverManager.getConnection(connectionString)) {
			List<Ingredient> categories = new ArrayList<Ingredient>();
			Statement statement = connection.createStatement();
			ResultSet rs = statement.executeQuery("select id, name, idParent from ingredient, parent where ingredient.id = parent.idIngredient");
			while (rs.next()) {
				int id = rs.getInt("id");
				String name = rs.getString("name");
				int parent = rs.getInt("idParent");
				boolean createNew = true;
				for (int i = 0; i < categories.size(); i++) {
					if (categories.get(i).getIngredientId() == id) {
						Ingredient category = categories.get(i);
						category.addParent(parent);
						categories.set(i, category);
						createNew = false;
					}
				}
				if (createNew) {
					Ingredient category = new Ingredient(id, name);
					category.addParent(parent);
					categories.add(category);
				}
			}
			connection.close();
			return categories;
		} catch (SQLException ex) {
			ex.printStackTrace();
			return null;
		}
	}