Example usage for org.hibernate Criteria setFirstResult

List of usage examples for org.hibernate Criteria setFirstResult

Introduction

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

Prototype

public Criteria setFirstResult(int firstResult);

Source Link

Document

Set the first result to be retrieved.

Usage

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

@Override
public List<EmpData> getAllDataByParamForOnlyEmployee(Long companyId, EmpDataSearchParameter searchParameter,
        int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParamOnlyEmployee(companyId, searchParameter, criteria);
    criteria.addOrder(order);//ww w .  ja v  a  2s  .c o m
    criteria.createAlias("golonganJabatan", "golonganJabatan", JoinType.LEFT_OUTER_JOIN);
    //        criteria.createAlias("taxFree", "taxFree", JoinType.INNER_JOIN);
    criteria.setFetchMode("bioData.city", FetchMode.JOIN);
    criteria.setFetchMode("bioData.maritalStatus", FetchMode.JOIN);
    criteria.setFetchMode("golonganJabatan.pangkat", FetchMode.JOIN);
    criteria.setFetchMode("jabatanByJabatanId.department", FetchMode.JOIN);
    criteria.setFetchMode("jabatanByJabatanId.unitKerja", 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> getAllDataByParamForOnlyEmployeeNotIncludeCompany(EmpDataSearchParameter searchParameter,
        int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParamOnlyEmployeeNotIncludeCompany(searchParameter, criteria);
    criteria.addOrder(order);/*www  .  j  a va  2  s.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 ww  .  j a  va  2s .c om
    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   www .  j  ava  2  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);//from   w  w  w. j av a2 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 ava 2s. co  m
    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) {/*from www  .  j  ava2  s. c  o m*/
    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);
    criteria.setMaxResults(7);/*from ww w .  ja va2s  .com*/
    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);/*from   w  ww. j  a va2  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   w ww  .java2 s . c  o m
    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();
}