private List<ControlHoras> getListWithRestriction(Criterion res[], FetchMode mode) { List<ControlHoras> lista = null; Session session = HibernateUtil.getSessionFactory().openSession(); // Obtener el control de Horas Criteria criteria = session .createCriteria(ControlHoras.class) .setFetchMode("horas", mode) .setFetchMode("estado", FetchMode.JOIN); for (Criterion crit : res) { criteria.add(crit); } lista = Collections.checkedList(criteria.list(), ControlHoras.class); session.close(); return lista; }
static List newList() { List s = Collections.checkedList(new ArrayList(), Integer.class); if (!s.isEmpty()) fail("New instance non empty."); return s; }