Example usage for org.hibernate Criteria setMaxResults

List of usage examples for org.hibernate Criteria setMaxResults

Introduction

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

Prototype

public Criteria setMaxResults(int maxResults);

Source Link

Document

Set a limit upon the number of objects to be retrieved.

Usage

From source file:com.inkubator.hrm.dao.impl.WtFingerExceptionDaoImpl.java

@Override
public List<WtFingerException> getByParamWithDetail(WtFingerExceptionSearchParameter searchParameter,
        int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearch(searchParameter, criteria);
    criteria.setFetchMode("empData.employeeType", FetchMode.JOIN);
    criteria.addOrder(order);/*from   www  .jav a2  s.c  o  m*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

From source file:com.inkubator.hrm.dao.impl.WtGroupWorkingDaoImpl.java

@Override
public List<WtGroupWorking> getByParam(WtGroupWorkingSearchParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchWtGroupWorkingByParam(searchParameter, criteria);
    criteria.addOrder(order);//w ww . ja  va2s. c  om
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

From source file:com.inkubator.hrm.dao.impl.WtHolidayDaoImpl.java

@Override
public List<WtHoliday> getByParam(HolidaySearchParameter searchParameter, int firstResult, int maxResults,
        Order order) {//from   w ww .  ja v a2s .  co  m
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchWtHolidayByParam(searchParameter, criteria);
    criteria.addOrder(order);
    criteria.createAlias("religion", "religion", JoinType.LEFT_OUTER_JOIN);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

From source file:com.inkubator.hrm.dao.impl.WtOverTimeDaoImpl.java

@Override
public List<WtOverTime> getByParam(WtOverTimeSearchParameter searchParameter, int firstResult, int maxResults,
        Order order) {//from w w w.  j  av  a 2s . c om
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchWtOverTimeByParam(searchParameter, criteria);
    criteria.addOrder(order);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

From source file:com.inkubator.hrm.dao.impl.WtPeriodeDaoImpl.java

@Override
public List<WtPeriode> getByParam(WtPeriodeSearchParameter searchParameter, int firstResult, int maxResults,
        Order order) {//from  www  . j a v a2  s  .  c  o  m
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchWtPeriodeByParam(searchParameter, criteria);
    criteria.addOrder(order);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

From source file:com.inkubator.hrm.dao.impl.WtScheduleShiftDaoImpl.java

@Override
public List<WtScheduleShift> getByParam(Long workingGroupId, int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchWtScheduleShiftByParam(workingGroupId, criteria);
    criteria.createAlias("wtWorkingHour", "wtWorkingHour", JoinType.INNER_JOIN);
    criteria.addOrder(order);/* w  w  w.j  a  v a 2s.c  o m*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

From source file:com.inventory.system.dao.StaffDAOImpl.java

@Override
public List<Teacher> fetchTeacherByDateRange(Date fromDate, Date toDate) {
    Session session = HibernateBDUtil.getSessionFactory().openSession();
    List<Teacher> list;// ww  w  .jav  a 2  s.c  om

    Criteria criteria = session.createCriteria(Teacher.class);
    criteria.add(Restrictions.between("registeredDate", fromDate, toDate));
    criteria.setFirstResult(0);
    criteria.setMaxResults(500);
    criteria.addOrder(Order.desc("id"));
    list = criteria.list();

    return list;
}

From source file:com.inventory.system.dao.StaffDAOImpl.java

@Override
public List<Teacher> fetchTeacher() {
    Session session = HibernateBDUtil.getSessionFactory().openSession();
    List<Teacher> list;//from w ww  .  jav a2s.c  o  m

    Criteria criteria = session.createCriteria(NonTeachingStaff.class);
    criteria.setFirstResult(0);
    criteria.setMaxResults(500);
    criteria.addOrder(Order.desc("id"));
    list = criteria.list();

    return list;
}

From source file:com.inventory.system.dao.StaffDAOImpl.java

@Override
public List<NonTeachingStaff> fetchByDateRange(Date fromDate, Date toDate) {
    Session session = HibernateBDUtil.getSessionFactory().openSession();
    List<NonTeachingStaff> list;

    Criteria criteria = session.createCriteria(NonTeachingStaff.class);
    criteria.add(Restrictions.between("registeredDate", fromDate, toDate));
    criteria.setFirstResult(0);//from w ww  .ja va  2s.  com
    criteria.setMaxResults(500);
    criteria.addOrder(Order.desc("id"));
    list = criteria.list();

    return list;
}

From source file:com.inventory.system.dao.StaffDAOImpl.java

@Override
public List<NonTeachingStaff> fetchNonTeachingStaff() {
    Session session = HibernateBDUtil.getSessionFactory().openSession();
    List<NonTeachingStaff> list;

    Criteria criteria = session.createCriteria(NonTeachingStaff.class);
    criteria.setFirstResult(0);// w ww .ja va2s  .  c o m
    criteria.setMaxResults(500);
    criteria.addOrder(Order.desc("id"));
    list = criteria.list();

    return list;
}