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

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

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

@Override
public List<Jabatan> getByParam(JabatanSearchParameter searchParameter, int firstResult, int maxResults,
        Order order) {/*www.jav  a2  s.com*/
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());

    //        criteria.setFetchMode("costCenter", FetchMode.JOIN);
    //        criteria.setFetchMode("golonganJabatan", FetchMode.JOIN);
    //        criteria.setFetchMode("department", FetchMode.JOIN);
    //        criteria.setFetchMode("unitKerja", FetchMode.JOIN);
    //        criteria.setFetchMode("jabatan", FetchMode.JOIN);
    //        criteria.setFetchMode("paySalaryGrade", FetchMode.JOIN);

    criteria.createAlias("costCenter", "costCenter", JoinType.INNER_JOIN);
    criteria.createAlias("golonganJabatan", "golonganJabatan", JoinType.INNER_JOIN);
    criteria.createAlias("golonganJabatan.pangkat", "pangkat", JoinType.INNER_JOIN);
    criteria.createAlias("department", "department", JoinType.INNER_JOIN);
    criteria.createAlias("unitKerja", "unitKerja", JoinType.INNER_JOIN);
    criteria.createAlias("jabatan", "jabatan", JoinType.LEFT_OUTER_JOIN);
    criteria.createAlias("paySalaryGrade", "paySalaryGrade", JoinType.INNER_JOIN);

    doSearchByParam(searchParameter, criteria);
    criteria.addOrder(order);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<Jabatan> getByName(String name) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    /** automatically get relations of department, company 
     *  don't create alias for that entity, or will get error : duplicate association path */
    criteria = this.addJoinRelationsOfCompanyId(criteria, HrmUserInfoUtil.getCompanyId());

    criteria.add(Restrictions.like("name", name, MatchMode.ANYWHERE));
    criteria.addOrder(Order.asc("name"));
    criteria.setFetchMode("department", FetchMode.JOIN);
    criteria.setFirstResult(0);
    criteria.setMaxResults(7);//from w ww .  j a  v a  2  s .  co  m
    return criteria.list();
}

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

@Override
public List<JabatanDeskripsi> getByParam(JabatanDeskripsiSearcParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(searchParameter, criteria);
    criteria.setFetchMode("jabatan", FetchMode.JOIN);
    criteria.addOrder(order);/*w w w  .  jav a  2  s .c o  m*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<KlasifikasiKerjaLevel> getByParam(KlasifikasiKerjaLevelSearchParameter searchParameter,
        int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(searchParameter, criteria);
    criteria.addOrder(order);/*from  www.  ja v a 2  s .com*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    criteria.createAlias("klasifikasiKerja", "klasifikasiKerja", JoinType.INNER_JOIN);
    return criteria.list();
}

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

@Override
public List<LoanCanceled> getByParam(LoanCanceledSearchParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());

    doSearchByParam(searchParameter, criteria);
    criteria.createAlias("loan", "loan", JoinType.INNER_JOIN);
    criteria.createAlias("loan.loanSchema", "loanSchema", JoinType.INNER_JOIN);
    criteria.setFetchMode("loan.empData", FetchMode.JOIN);
    criteria.setFetchMode("loan.empData.bioData", FetchMode.JOIN);
    criteria.add(Restrictions.eq("loan.statusPencairan", HRMConstant.LOAN_CANCELED));
    criteria.addOrder(order);// w w  w  .ja va  2  s .c  o  m
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<LoanNewApplication> getByParamByStatusUndisbursed(LoanNewSearchParameter parameter, int firstResult,
        int maxResults, Order orderable) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(parameter, criteria);
    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("empData.bioData", FetchMode.JOIN);
    criteria.setFetchMode("loanNewSchema", FetchMode.JOIN);
    criteria.setFetchMode("loanNewType", FetchMode.JOIN);
    criteria.add(Restrictions.eq("loanStatus", HRMConstant.LOAN_UNDISBURSED));
    criteria.addOrder(orderable);/*w w w .j ava  2  s . co m*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<LoanNewSchema> getAllDataByParam(LoanNewSchemaSearchParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(searchParameter, criteria);
    //        criteria.setFetchMode("costCenter", FetchMode.JOIN);
    criteria.addOrder(order);/*  ww w  . j  ava2s . c  o  m*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<LoanNewType> getByParam(LoanNewTypeSearchParameter parameter, int firstResult, int maxResults,
        Order orderable) {/* w  w  w.j  a v  a  2s  . co m*/
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("currency", "currency", JoinType.INNER_JOIN);
    doSearchLoanTypeByParam(parameter, criteria);
    criteria.addOrder(orderable);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<LoanType> getByParam(LoanTypeSearchParameter parameter, int firstResult, int maxResults,
        Order orderable) {//from w  w  w .  ja  v  a  2  s .  c o  m
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchLoanTypeByParam(parameter, criteria);
    criteria.createAlias("currency", "currency", JoinType.INNER_JOIN);
    criteria.addOrder(orderable);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}