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.LoginHistoryDaoImpl.java

@Override
public List<LoginHistory> getByParam(int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("hrmUser", "hrmUser", JoinType.LEFT_OUTER_JOIN);
    criteria.addOrder(order);//w w  w .  j  a va  2s . c  om
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<LoginHistory> getByParam(LoginHistorySearchParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchLoginHistByParam(searchParameter, criteria);
    criteria.createAlias("hrmUser", "hrmUser", JoinType.LEFT_OUTER_JOIN);
    criteria.addOrder(order);//  ww  w  .  j av a2 s .com
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<LogWtAttendanceRealization> getAllDataByParam(LogWtAttendanceRealizationModel model,
        int firstResult, int maxResults, Order orderable) {

    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    //      criteria.add(Restrictions.ge("periodeDateStart", model.getStartPeriod()));
    //      criteria.add(Restrictions.lt("periodeDateEnd", model.getEndPeriod()));
    if (model.getWtPeriodeId() != null) {
        criteria.add(Restrictions.eq("wtPeriodeId", model.getWtPeriodeId()));
    }/* ww  w. j  a v a 2s  .c o  m*/

    if (model.getListDeptName() != null && model.getListDeptName().size() > 0) {
        criteria.add(Restrictions.in("empDepartementName", model.getListDeptName()));
    }

    if (model.getListGolJabName() != null && model.getListGolJabName().size() > 0) {
        criteria.add(Restrictions.in("empGolJab", model.getListGolJabName()));
    }
    //        if (model.getListGolJabName() != null) {
    //            criteria.add(Restrictions.in("empGolJab", model.getListGolJabName()));
    //        }
    criteria.addOrder(orderable);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<MecineFinger> getByParam(MecineFingerSearchParameter parameter, int firstResult, int maxResults,
        Order orderable) {/*from   w ww  .jav a  2s . com*/
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchMecineFingerByParam(parameter, criteria);
    criteria.addOrder(orderable);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<OhsaCategory> getByParam(OhsaCategorySearchParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(searchParameter, criteria);
    criteria.addOrder(order);//from w  w w. j a  v  a 2  s.co m
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<OhsaIncident> getByParam(OhsaIncidentSearchParameter parameter, int firstResult, int maxResults,
        Order orderable) {/*from   w  w w. ja  v a2  s. c om*/
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    //   criteria.setFetchMode("ohsaCategory", FetchMode.JOIN);               
    doSearchByParam(parameter, criteria);

    criteria.addOrder(orderable);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);

    return criteria.list();
}

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

@Override
public List<OrgTypeOfSpecJabatan> getAllDataByJabatanId(Long id, int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("jabatan.id", id));
    criteria.setFetchMode("jabatan", FetchMode.JOIN);
    criteria.setFetchMode("orgTypeOfSpecList", FetchMode.JOIN);

    criteria.createAlias("jabatan", "jabatan", JoinType.INNER_JOIN);
    criteria.createAlias("orgTypeOfSpecList", "orgTypeOfSpecList", JoinType.INNER_JOIN);

    criteria.addOrder(order);/*www  .j  a va2  s.com*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<OrgTypeOfSpecList> getByParam(OrgTypeOfSpecListSearchParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(searchParameter, criteria);
    criteria.addOrder(order);//from   w  w  w  .  j a  v a 2  s  . co m
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    criteria.setFetchMode("orgTypeOfSpec", FetchMode.JOIN);
    criteria.createAlias("orgTypeOfSpec", "orgTypeOfSpec", JoinType.INNER_JOIN);
    return criteria.list();
}

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

@Override
public List<OverTimeDistribution> getByParamWithDetail(OverTimeDistributionSearchParameter searchParameter,
        int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearch(searchParameter, criteria);
    //criteria.setFetchMode("empData", FetchMode.JOIN);
    //criteria.setFetchMode("empData.bioData", FetchMode.JOIN);
    //criteria.setFetchMode("wtOverTime", FetchMode.JOIN);
    criteria.addOrder(order);// ww  w  . j  a  v a 2 s  . co  m
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<PasswordHistory> getByParam(PasswordHistorySearchParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchPasswordHistByParam(searchParameter, criteria);
    //        criteria.createAlias("hrmUser", "hrmUser", JoinType.LEFT_OUTER_JOIN);
    criteria.addOrder(order);// ww w  . j  a v a2 s. c  om
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}