List of usage examples for org.hibernate Criteria setResultTransformer
public Criteria setResultTransformer(ResultTransformer resultTransformer);
From source file:com.app.billingapp.dao.impl.RolesImpl.java
@SuppressWarnings("unchecked") public List<Roles> fildAllRole() { List<Roles> roles;/*from w ww . ja v a 2 s. co m*/ Criteria crit = createEntityCriteria(); crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); roles = (List<Roles>) crit.list(); return roles; }
From source file:com.app.billingapp.dao.impl.UserImpl.java
@Override public List<User> findAllUser() { List<User> users;/*from w w w .j a v a2s.c o m*/ Criteria crit = createEntityCriteria(); crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); users = (List<User>) crit.list(); return users; }
From source file:com.app.billingapp.dao.impl.VendorDaoImpl.java
@Override public List<Vendors> findAll() { List<Vendors> vendors = null; Criteria criteria = createEntityCriteria(); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); vendors = criteria.list();/* w ww .j a v a 2 s. c om*/ return vendors; }
From source file:com.ar.dev.tierra.api.dao.impl.FacturaDAOImpl.java
@SuppressWarnings("unchecked") @Override/* ww w . j av a2 s.co m*/ public List<Factura> getAll() { Criteria criteria = getSession().createCriteria(Factura.class); criteria.add(Restrictions.not(Restrictions.in("estado", new String[] { "RESERVADO" }))); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); List<Factura> list = criteria.list(); return list; }
From source file:com.ar.dev.tierra.api.dao.impl.FacturaDAOImpl.java
@Override public List<Factura> getDiary() { Criteria criteria = getSession().createCriteria(Factura.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("idFactura")); criteria.add(Restrictions.not(Restrictions.in("estado", new String[] { "RESERVADO" }))); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); criteria.addOrder(Order.desc("idFactura")); List<Factura> list = criteria.list(); return list;// ww w. ja v a2 s.c om }
From source file:com.ar.dev.tierra.api.dao.impl.FacturaDAOImpl.java
@Override public List<Factura> getMonth() { Criteria criteria = getSession().createCriteria(Factura.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.add(Restrictions.not(Restrictions.in("estado", new String[] { "RESERVADO" }))); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); criteria.addOrder(Order.desc("idFactura")); List<Factura> list = criteria.list(); return list;//from ww w.ja va 2 s . c om }
From source file:com.ar.dev.tierra.api.dao.impl.FacturaDAOImpl.java
@Override public List<Factura> getDiaryReserva() { Criteria criteria = getSession().createCriteria(Factura.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("idFactura")); criteria.add(Restrictions// w ww. j av a 2 s .c om .not(Restrictions.in("estado", new String[] { "INICIADO", "CONFIRMADO", "CANCELADO" }))); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); List<Factura> list = criteria.list(); return list; }
From source file:com.ar.dev.tierra.api.dao.impl.FacturaDAOImpl.java
@Override public List<Factura> getMonthReserva() { Criteria criteria = getSession().createCriteria(Factura.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.add(Restrictions// w w w.ja v a 2 s . c om .not(Restrictions.in("estado", new String[] { "INICIADO", "CONFIRMADO", "CANCELADO" }))); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); criteria.addOrder(Order.desc("idFactura")); List<Factura> list = criteria.list(); return list; }
From source file:com.ar.dev.tierra.api.dao.impl.ProductoDAOImpl.java
@SuppressWarnings("unchecked") @Override//from www . j av a 2 s .c o m public List<Producto> getAll() { Criteria criteria = getSession().createCriteria(Producto.class); ProjectionList projList = Projections.projectionList(); projList.add(Projections.property("idProducto"), "idProducto"); projList.add(Projections.property("marcas"), "marcas"); projList.add(Projections.property("descripcion"), "descripcion"); projList.add(Projections.property("colorProducto"), "colorProducto"); projList.add(Projections.property("cantidadTotal"), "cantidadTotal"); projList.add(Projections.property("talla"), "talla"); criteria.add(Restrictions.eq("estadoProducto", true)); criteria.addOrder(Order.desc("idProducto")); criteria.setProjection(Projections.distinct(projList)); criteria.setResultTransformer(Transformers.aliasToBean(Producto.class)); List<Producto> list = criteria.list(); return list; }
From source file:com.ar.dev.tierra.api.dao.impl.UsuariosDAOImpl.java
@SuppressWarnings("unchecked") @Override//from w w w. j a v a2 s .c o m public List<Usuarios> allUsuarios() { Criteria criteria = getSession().createCriteria(Usuarios.class); criteria.addOrder(Order.asc("idUsuario")); ProjectionList projList = Projections.projectionList(); projList.add(Projections.property("idUsuario"), "idUsuario"); projList.add(Projections.property("roles"), "roles"); projList.add(Projections.property("nombre"), "nombre"); projList.add(Projections.property("apellido"), "apellido"); projList.add(Projections.property("dni"), "dni"); projList.add(Projections.property("telefono"), "telefono"); projList.add(Projections.property("email"), "email"); projList.add(Projections.property("fechaNacimiento"), "fechaNacimiento"); projList.add(Projections.property("domicilio"), "domicilio"); projList.add(Projections.property("estado"), "estado"); projList.add(Projections.property("ultimaConexion"), "ultimaConexion"); projList.add(Projections.property("usuarioSucursal"), "usuarioSucursal"); criteria.setProjection(Projections.distinct(projList)); criteria.setResultTransformer(Transformers.aliasToBean(Usuarios.class)); List<Usuarios> us = criteria.list(); return us; }