Example usage for org.hibernate Criteria addOrder

List of usage examples for org.hibernate Criteria addOrder

Introduction

In this page you can find the example usage for org.hibernate Criteria addOrder.

Prototype

public Criteria addOrder(Order order);

Source Link

Document

Add an Order ordering to the result set.

Usage

From source file:com.ar.dev.tierra.api.dao.impl.FacturaProductoDAOImpl.java

@SuppressWarnings("unchecked")
@Override//from  w ww  .java  2 s . c o  m
public List<FacturaProducto> getAll() {
    Criteria criteria = getSession().createCriteria(FacturaProducto.class);
    criteria.add(Restrictions.eq("estado", true));
    criteria.addOrder(Order.desc("idFacturaProducto"));
    List<FacturaProducto> list = criteria.list();
    return list;
}

From source file:com.ar.dev.tierra.api.dao.impl.MarcasDAImpl.java

@SuppressWarnings("unchecked")
@Override//  ww  w  .  j a v  a2s. com
public List<Marcas> getAll() {
    Criteria criteria = getSession().createCriteria(Marcas.class);
    criteria.add(Restrictions.eq("estado", true));
    criteria.addOrder(Order.asc("idMarca"));
    List<Marcas> list = criteria.list();
    return list;
}

From source file:com.ar.dev.tierra.api.dao.impl.MedioPagoDAOImpl.java

@SuppressWarnings("unchecked")
@Override/*from w  w w.j  av a2 s  . c o m*/
public List<MedioPago> getAll() {
    Criteria criteria = getSession().createCriteria(MedioPago.class);
    criteria.add(Restrictions.eq("estado", true));
    criteria.addOrder(Order.asc("idMedioPago"));
    List<MedioPago> list = criteria.list();
    return list;
}

From source file:com.ar.dev.tierra.api.dao.impl.MetodoPagoFacturaDAOImpl.java

@SuppressWarnings("unchecked")
@Override//from   w  w w.j  a  va 2  s . co m
public List<MetodoPagoFactura> getAll() {
    Criteria criteria = getSession().createCriteria(MetodoPagoFactura.class);
    criteria.add(Restrictions.eq("estado", true));
    criteria.addOrder(Order.asc("idMetodoPagoFactura"));
    List<MetodoPagoFactura> list = criteria.list();
    return list;
}

From source file:com.ar.dev.tierra.api.dao.impl.MetodoPagoFacturaDAOImpl.java

@Override
public List<MetodoPagoFactura> getDay() {
    Criteria criteria = getSession().createCriteria(MetodoPagoFactura.class);
    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    Date fromDate = calendar.getTime();
    calendar.set(Calendar.HOUR_OF_DAY, 23);
    calendar.set(Calendar.MINUTE, 59);
    calendar.set(Calendar.SECOND, 59);
    Date toDate = calendar.getTime();
    criteria.add(Restrictions.between("fechaCreacion", fromDate, toDate));
    criteria.addOrder(Order.asc("idMetodoPagoFactura"));
    List<MetodoPagoFactura> list = criteria.list();
    return list;/*w w w. j a  va  2  s .  c  o m*/
}

From source file:com.ar.dev.tierra.api.dao.impl.NotaCreditoDAOImpl.java

@SuppressWarnings("unchecked")
@Override//from ww  w . ja  v  a  2  s  .c  om
public List<NotaCredito> getAll() {
    Criteria criteria = getSession().createCriteria(NotaCredito.class);
    criteria.addOrder(Order.desc("idNotaCredito"));
    List<NotaCredito> list = criteria.list();
    return list;
}

From source file:com.ar.dev.tierra.api.dao.impl.NotaCreditoDAOImpl.java

@Override
public List<NotaCredito> searchByIdCliente(int idCliente) {
    Criteria criteria = getSession().createCriteria(NotaCredito.class);
    criteria.add(Restrictions.eq("idCliente", idCliente));
    criteria.addOrder(Order.desc("idNotaCredito"));
    List<NotaCredito> list = criteria.list();
    return list;// w  ww.  j  av a 2s.  c  o  m
}

From source file:com.ar.dev.tierra.api.dao.impl.NotaCreditoDAOImpl.java

@Override
public List<NotaCredito> getDaily() {
    Criteria criteria = getSession().createCriteria(NotaCredito.class);
    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    Date fromDate = calendar.getTime();
    calendar.set(Calendar.HOUR_OF_DAY, 23);
    calendar.set(Calendar.MINUTE, 59);
    calendar.set(Calendar.SECOND, 59);
    Date toDate = calendar.getTime();
    criteria.add(Restrictions.between("fechaCreacion", fromDate, toDate));
    criteria.addOrder(Order.desc("idNotaCredito"));
    List<NotaCredito> list = criteria.list();
    return list;//from   ww  w  .ja va  2s  .c o m
}

From source file:com.ar.dev.tierra.api.dao.impl.NotaCreditoDAOImpl.java

@Override
public List<NotaCredito> getMonth() {
    Criteria criteria = getSession().createCriteria(NotaCredito.class);
    Calendar calendar = Calendar.getInstance();
    Date toDate = calendar.getTime();
    calendar.add(Calendar.MONTH, -1);
    Date fromDate = calendar.getTime();
    criteria.add(Restrictions.between("fechaCreacion", fromDate, toDate));
    criteria.addOrder(Order.desc("idNotaCredito"));
    List<NotaCredito> list = criteria.list();
    return list;//www  . j  a  v a 2  s.  c om
}

From source file:com.ar.dev.tierra.api.dao.impl.PlanPagoDAOImpl.java

@SuppressWarnings("unchecked")
@Override//from ww w .  j  a  v a  2  s. c o m
public List<PlanPago> getAll() {
    Criteria criteria = getSession().createCriteria(PlanPago.class);
    criteria.add(Restrictions.eq("estadoPlanes", true));
    criteria.addOrder(Order.asc("idPlanesPago"));
    List<PlanPago> list = criteria.list();
    return list;
}