/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package inventario.facade;


import inventario.facade.remote.OutcomeFacadeRemote;
import inventario.entity.Outcome;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Daniel
 */
@Stateless
public class OutcomeFacade implements  OutcomeFacadeRemote {
    @PersistenceContext
    private EntityManager em;

    public void create(Outcome outcome) {
        em.persist(outcome);
    }

    public void edit(Outcome outcome) {
        em.merge(outcome);
    }

    public void remove(Outcome outcome) {
        em.remove(em.merge(outcome));
    }

    public Outcome find(Object id) {
        return em.find(Outcome.class, id);
    }

    public List<Outcome> findAll() {
        return em.createQuery("select object(o) from Outcome as o").getResultList();
    }

}
