/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ec.gob.mcds.seguridades.dao; import ec.gob.mcds.seguridades.generico.Generico; import ec.gob.mcds.seguridades.model.Institucion; import java.util.List; import javax.ejb.LocalBean; import javax.ejb.Stateless; import javax.persistence.Query; /** * * @author christian */ @LocalBean @Stateless public class InstitucionDao extends Generico<Institucion> { public InstitucionDao() { super(Institucion.class); } /** * método que devuelve todas las instituciones activas del sistema de * seguridades. * * @throws Exception * @return List */ public List<Institucion> listarTodoActivo() throws Exception { String jpaQl = "SELECT i FROM Institucion i" + " WHERE i.estado = true" + " ORDER BY i.nombre"; Query query = getEntityManager().createQuery(jpaQl); return query.getResultList(); } /** * método que devuelve todas las instituciones del sistema de seguridades. * * @throws Exception * @return List */ public List<Institucion> listarTodo() throws Exception { String jpaQl = "SELECT i FROM Institucion i" + " ORDER BY i.nombre"; Query query = getEntityManager().createQuery(jpaQl); return query.getResultList(); } }