edgar 2016-07-15 19:00:58 +00:00
parent 2fc744d3d9
commit 56c3cfcf80
2 changed files with 8 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import java.io.Serializable;
import java.util.List; import java.util.List;
import org.hibernate.Criteria; import org.hibernate.Criteria;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions; import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
@ -32,7 +33,7 @@ public class EmpleadoHibernateDAO extends GenericHibernateDAO<Empleado, Integer>
public List<Empleado> obtenerTodos() { public List<Empleado> obtenerTodos() {
Criteria c = getSession().createCriteria(getPersistentClass()); Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE)); c.add(Restrictions.eq("activo", Boolean.TRUE));
c.addOrder(Order.asc("nombEmpleado"));
return c.list(); return c.list();
} }
@ -49,6 +50,7 @@ public class EmpleadoHibernateDAO extends GenericHibernateDAO<Empleado, Integer>
Criteria c = getSession().createCriteria(getPersistentClass()); Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("empresa.empresaId", empresaId)); c.add(Restrictions.eq("empresa.empresaId", empresaId));
c.add(Restrictions.eq("activo", Boolean.TRUE)); c.add(Restrictions.eq("activo", Boolean.TRUE));
c.addOrder(Order.asc("nombEmpleado"));
return c.list(); return c.list();
} }
} }

View File

@ -8,12 +8,15 @@ import java.util.List;
import org.hibernate.Criteria; import org.hibernate.Criteria;
import org.hibernate.FetchMode; import org.hibernate.FetchMode;
import org.hibernate.Query;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.MatchMode; import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Order; import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projection;
import org.hibernate.criterion.Restrictions; import org.hibernate.criterion.Restrictions;
import org.hibernate.transform.AliasToBeanResultTransformer;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -99,8 +102,10 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO<PuntoVenta, Inte
public List<PuntoVenta> buscaPuntoVentaParada(Parada parada) { public List<PuntoVenta> buscaPuntoVentaParada(Parada parada) {
Criteria c = getSession().createCriteria(getPersistentClass()); Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE)); c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("parada", parada)); c.add(Restrictions.eq("parada", parada));
c.addOrder(Order.asc("nombpuntoventa")); c.addOrder(Order.asc("nombpuntoventa"));
return c.list(); return c.list();