1415161718192021
public Recipe loadRecipe(int id) throws RecipeException { try { return (Recipe) getJpaTemplate().find(Recipe.class, id); } catch (DataAccessException ex) { throw new RecipeException(id, "Error loading the recipe.", ex); } }
2526272829303132
try { getJpaTemplate().persist(recipe); return recipe; } catch (DataAccessException ex) { throw new RecipeException(recipe.getId(), "Error saving the recipe.", ex); } }
3637383940414243
try { final Recipe recipe = loadRecipe(id); return removeRecipe(recipe); } catch (DataAccessException ex) { throw new RecipeException(id, "Error removing the recipe.", ex); } }
4748495051525354
try { getJpaTemplate().remove(recipe); return recipe; } catch (DataAccessException ex) { throw new RecipeException(recipe.getId(), "Error removing the recipe.", ex); } }