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

package manager;

import entities.Semester;
import entities.Subject;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author Szilárd
 */
@Stateless
public class SubjectSessionBean implements SubjectSessionBeanRemote {
    
    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
     @PersistenceContext
    private EntityManager em;

    public void newSubject(Subject s) {
        em.persist(s);
    }

    public List<Subject> allSubjects() {
        Query query = em.createNamedQuery("Subject.findAll");
        return query.getResultList();
    }
 
}
