Package fr.valtech.many2many.domain

Examples of fr.valtech.many2many.domain.Ingredient


        detachedRecipe.setTitle(r.getTitle());

        Iterator<RecipeIngredient> it = r.getRecipeIngredients().iterator();
        while (it.hasNext()) {
            RecipeIngredient ri = it.next();
            Ingredient i = new Ingredient();
            i.setId(ri.getIngredient().getId());
            RecipeIngredient detachedRi = new RecipeIngredient(i,
                    ri.getAmount());
            detachedRecipe.addRecipeIngredient(detachedRi);
        }
View Full Code Here


    private void reatachIngredients(Recipe recipe) {

        for (Iterator<RecipeIngredient> it = recipe.getRecipeIngredients()
                .iterator(); it.hasNext();) {
            RecipeIngredient ri = it.next();
            Ingredient ingredient = ri.getIngredient();
            if (ingredient.getId() != null && ingredient.getId() != 0) {
                Ingredient reference = getEntityManager().getReference(
                        Ingredient.class, ingredient.getId());
                ri.setIngredient(reference);
            } else {
                getEntityManager().persist(ingredient);
            }
View Full Code Here

                cb.parameter(String.class, "label")));
        TypedQuery<Ingredient> tq = getEntityManager().createQuery(
                criteriaQuery);
        tq.setParameter("label", label);

        Ingredient ingredient = null;
        try {
            ingredient = tq.getSingleResult();
        } catch (NoResultException nre) {
            getLogger().info("no result found");
        }
View Full Code Here

TOP

Related Classes of fr.valtech.many2many.domain.Ingredient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.