/* * AccountFacade.java * * Created on 13 novembre 2007, 21:28 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package stickies.srv; import java.util.List; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; /** * * @author mr */ @Stateless public class AccountFacade implements AccountFacadeRemote { @PersistenceContext private EntityManager em; /** Creates a new instance of AccountFacade */ public AccountFacade() { } public void create(Account account) { em.persist(account); } public void edit(Account account) { em.merge(account); } public void destroy(Account account) { em.merge(account); em.remove(account); } public Account find(Object pk) { return (Account) em.find(Account.class, pk); } public List findAll() { return em.createQuery("select object(o) from Account as o").getResultList(); } }