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

@Override
public List<EmpData> getAllDataByParamForOnlyEmployeeNotIncludeCompany(EmpDataSearchParameter searchParameter,
        int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParamOnlyEmployeeNotIncludeCompany(searchParameter, criteria);
    criteria.addOrder(order);//  w w w . j ava 2s . c  o  m
    //        criteria.createAlias("golonganJabatan", "golonganJabatan", JoinType.LEFT_OUTER_JOIN);

    criteria.setFetchMode("bioData.city", FetchMode.JOIN);
    criteria.setFetchMode("bioData.maritalStatus", FetchMode.JOIN);
    criteria.setFetchMode("golonganJabatan.pangkat", FetchMode.JOIN);
    criteria.setFetchMode("jabatanByJabatanId", FetchMode.JOIN);
    criteria.setFetchMode("jabatanByJabatanId.department", FetchMode.JOIN);
    criteria.setFetchMode("jabatanByJabatanId.unitKerja", FetchMode.JOIN);
    criteria.setFetchMode("taxFree", FetchMode.JOIN);
    criteria.setFetchMode("golonganJabatan", FetchMode.JOIN);
    //        criteria.setFetchMode("wtGroupWorking", FetchMode.JOIN);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<EmpData> getAllEmployeeForRecruitAggrementNotice(
        RecruitAgreementNoticeSearchParameter searchParameter, int firstResult, int maxResults,
        Order orderable) {/*  w  w  w  .  j  a  v a2 s . c o  m*/
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchEmployeeForRecruitAggrementNotice(searchParameter, criteria);
    criteria.addOrder(orderable);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<FamilyRelation> getByParam(FamilyRelationSearchParameter parameter, int firstResult, int maxResults,
        Order orderable) {/*from   ww  w  . j  a  v a2 s .  c  om*/
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchFamilyRelationByParam(parameter, criteria);
    criteria.addOrder(orderable);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<GolonganJabatan> getByParam(GolonganJabatanSearchParameter parameter, int firstResult,
        int maxResults, Order orderable) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());

    //        criteria.setFetchMode("pangkat", FetchMode.JOIN);
    //        criteria.setFetchMode("paySalaryGrade", FetchMode.JOIN);
    //        criteria.setFetchMode("paySalaryGrade.currency", FetchMode.JOIN);

    doSearchByParam(parameter, criteria);

    criteria.addOrder(orderable);// w  w  w .ja  v  a 2 s. c  o  m
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<HrmRole> getByParam(HrmRoleSearchParameter searchParameter, int firstResult, int maxResults,
        Order order) {/*from  w ww  .  j  a va 2  s.com*/
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchLHrmRoleByParam(searchParameter, criteria);
    criteria.addOrder(order);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<HrmUser> getByParam(HrmUserSearchParameter searchParameter, int firstResult, int maxResults,
        Order order) {// w ww .ja v a  2  s.  com
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchSpiUserByParam(searchParameter, criteria);
    criteria.addOrder(order);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<HrmUser> getByName(String name) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.like("realName", name, MatchMode.ANYWHERE));
    criteria.add(Restrictions.eq("isActive", HRMConstant.ACTIVE));
    criteria.setFirstResult(0);//from   w  ww. ja  v  a 2 s.co  m
    criteria.setMaxResults(7);
    return criteria.list();
}

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

@Override
public List<Reimbursment> getByParam(String parameter, InclusionReimbursmentModel inclusionReimbursmentModel,
        int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(parameter, criteria, inclusionReimbursmentModel);
    criteria.addOrder(order);//  ww w.  j ava 2  s . c om
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<Insurance> getByParam(InsuranceSearchParameter parameter, int firstResult, int maxResults,
        Order orderable) {/*from   ww w.  ja v  a2s . c om*/
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("city", FetchMode.JOIN);
    criteria.setFetchMode("city.province", FetchMode.JOIN);
    criteria.setFetchMode("city.province.country", 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.IpPermitDaoImpl.java

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