package fr.kaddath.apps.saepejb.sessionbeans;
import javax.ejb.Stateless;
import javax.interceptor.Interceptors;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import fr.kaddath.apps.saepejb.models.Structure;
import fr.kaddath.apps.saepejb.models.db.ReportingInterceptor;
@Stateless
public class StructuresSessionBean implements StructuresBeanLocal,StructuresBeanRemote {
@PersistenceContext(unitName = "SAEP-ejbPU")
private EntityManager em;
@Interceptors(ReportingInterceptor.class)
public void saveStructure(Structure structure) {
em.persist(structure);
}
public Structure getStructureById(String id) {
return em.find(Structure.class,id);
}
}
|