package sklep.soap;

import java.util.List;

import javax.jws.WebResult;
import javax.jws.WebService;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;

import sklep.model.Product;

@WebService
public class SklepSoap {
	@PersistenceContext(unitName="sklep_pu")
	private EntityManager em;

	@WebResult(name="product")
	public List<Product> readAll()  {
		TypedQuery<Product> query = em.createNamedQuery("Product.findAll", Product.class);
		List<Product> products = query.getResultList();
		return products;
	}

}
