title: How to make the PUT method work? I want to update my data in Table
body: <p>This is my POST method and it is successful and run well. My question is how to do the PUT request method so that it can update the data well?</p>
  
  <h2>Post method</h2>
  
  <pre><code>public void addRecipe(RecipeDTO recipedto)
  {
      Category categoryTitle = categoryRepository.findByCategoryTitle(recipedto.getCategoryTitle());
      Recipe recipe = new Recipe();
  
     /*I map my dto data original model*/
  
      recipe.setRID(recipedto.getrID());
      recipe.setRecipeTitle(recipedto.getRecipeTitle());
      recipe.setDescription(recipedto.getDescription());
      recipe.setCookTime(recipedto.getCookTime());
  
      List categoryList = new ArrayList&lt;&gt;();
      categoryList.add(categoryTitle);
  
      recipe.setCategories(categoryList);
  
      Recipe savedRecipe = recipeRepository.save(recipe);
  
  
      /*I map the data in ingredientDTO and setpDTO to actual model */
  
      List ingredientList = new ArrayList&lt;&gt;();
      for(IngredientDTO ingredientdto : recipedto.getIngredients())
      {   
          Ingredient ingredient = new Ingredient();
  
          ingredient.setIID(ingredientdto.getiID());
          ingredient.setIngredientName(ingredientdto.getIngredientName());
          ingredient.setRecipe(savedRecipe);
  
          ingredientList.add(ingredient);
  
      }
  
      List stepList = new ArrayList&lt;&gt;();
      for(StepDTO stepdto : recipedto.getSteps())
      {   
          Step step = new Step();
  
          step.setSID(stepdto.getsID());
          step.setStepDescription(stepdto.getStepDescription());
          step.setStepNumber(stepdto.getStepNumber());
          step.setRecipe(savedRecipe);
  
  
          stepList.add(step);
  
      }
  
      ingredientRepository.save(ingredientList);
      stepRepository.save(stepList);
  
  
  }
  </code></pre>
  
  <p>This is my put method and it wont work, how should I do it, because I have no idea. Please teach me to do this method, if it is better.</p>
  
  <pre><code>public void updateRecipe(RecipeDTO recipedto, String id)
  {
      Recipe recipe = recipeRepository.findByrID(recipedto.getrID());
      if(id==recipedto.getrID().toString())
      {
          recipeRepository.save(recipe);
      }
  }
  </code></pre>