/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.rjconsultores.ventaboletos.dao.hibernate; import java.util.List; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.SessionFactory; import org.hibernate.criterion.Restrictions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Repository; import com.rjconsultores.ventaboletos.dao.RutaEmpresaDAO; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.RutaEmpresa; /** * * @author Administrador */ @Repository("rutaEmpresaDAO") public class RutaEmpresaHibernateDAO extends GenericHibernateDAO implements RutaEmpresaDAO { @Autowired public RutaEmpresaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { setSessionFactory(factory); } public List obtenerPorEmpresa(Empresa empresa){ StringBuilder sb = new StringBuilder(); sb.append("select * from Ruta_Empresa where empresa_Id = :empresaId and activo = 1" ); Query qry = getSession().createSQLQuery(sb.toString()); qry.setInteger("empresaId", empresa.getEmpresaId()); return qry.list(); } }