diff --git a/client/src/main/java/client/utils/ServerUtils.java b/client/src/main/java/client/utils/ServerUtils.java index 9894c80..736b4cd 100644 --- a/client/src/main/java/client/utils/ServerUtils.java +++ b/client/src/main/java/client/utils/ServerUtils.java @@ -146,7 +146,9 @@ public class ServerUtils { Recipe recipe = objectMapper.readValue(response.body(), Recipe.class); recipe.setId(null); // otherwise the id is the same as the original, and that's wrong - + // now that each recipeIngredient has its own ID in the database, + // we set that to null too to force a new persist value on the server + recipe.getIngredients().forEach(ingredient -> ingredient.setId(null)); return addRecipe(recipe); }