Skip to content
Snippets Groups Projects
Commit 4dd9cf40 authored by Gwendal Margely's avatar Gwendal Margely :alembic:
Browse files

Add delete Ingredient method

parent 2aa59ba4
No related branches found
No related tags found
No related merge requests found
...@@ -86,6 +86,13 @@ public class IngredientDAO { ...@@ -86,6 +86,13 @@ public class IngredientDAO {
return ingredient; return ingredient;
} }
public void deleteIngredient(int id) { public void deleteIngredient(int id) throws SQLException {
String deleteQuery = "DELETE FROM ingredients WHERE id = ?";
try (Connection connection = DriverManager.getConnection(url, user, password);
PreparedStatement statement = connection.prepareStatement(deleteQuery)) {
statement.setInt(1, id);
statement.executeUpdate();
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment