wilian 2015-08-19 21:51:43 +00:00
parent 50c97f60d1
commit 2adaa14c47
1 changed files with 5 additions and 2 deletions

View File

@ -7,11 +7,11 @@ 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.Order;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
@ -41,6 +41,7 @@ public class RutaHibernateDAO extends GenericHibernateDAO<Ruta, Integer>
public List<Ruta> obtenerTodos() {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.ne("rutaId", -1));
c.addOrder(Order.asc("descruta"));
return c.list();
@ -97,6 +98,7 @@ public class RutaHibernateDAO extends GenericHibernateDAO<Ruta, Integer>
public List<Ruta> obtenerPorEmpresa(Empresa empresa) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.ne("rutaId", -1));
if (empresa.getEmpresaId() != -1) {
c.createCriteria("lsRutaEmpresa").add(Restrictions.eq("empresa", empresa));
@ -166,5 +168,6 @@ public class RutaHibernateDAO extends GenericHibernateDAO<Ruta, Integer>
List<Ruta> lsRuta = sq.list();
return lsRuta;
}
}
}