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

@Override
public List<PayComponentDataException> getByParamWithDetailForDetail(String searchParameter,
        String paySalaryComponentId, int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParamForDetail(searchParameter, criteria);
    criteria.add(Restrictions.eq("paySalaryComponent.id", Long.valueOf(paySalaryComponentId.substring(1))));
    criteria.addOrder(order);//w w  w  .  ja  va  2s .  c  om
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<PaySalaryComponent> getAllDataByParamWithDetail(PaySalaryComponentSearchParameter searchParameter,
        int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("modelComponent", FetchMode.JOIN);
    criteria.setFetchMode("paySalaryJurnal", FetchMode.JOIN);
    criteria.setFetchMode("taxComponent", FetchMode.JOIN);
    doSearchByParam(searchParameter, criteria);
    criteria.addOrder(order);//  w w w  .  j av  a2 s . c  om
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<PaySalaryComponent> getAllDataComponentUploadByParam(
        PaySalaryComponentSearchParameter searchParameter, int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    this.doSearchComponentUploadByParam(searchParameter, criteria);
    /*criteria.setFetchMode("payTempUploadDatas", FetchMode.JOIN);
     criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);*/
    criteria.addOrder(order);//from   w  ww  . jav a2s .c  o  m
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();

}

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

@Override
public PaySalaryComponent getEntityBySpecificModelComponent(Integer specific) {
    PaySalaryComponent paySalaryComponent = null;

    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("modelComponent", "modelComponent", JoinType.INNER_JOIN);
    criteria.add(Restrictions.eq("modelComponent.spesific", specific));
    criteria.addOrder(Order.desc("createdOn"));
    criteria.setFirstResult(0);
    criteria.setMaxResults(1);/*from   w ww . ja v a  2s .c  o  m*/

    if (!criteria.list().isEmpty()) {
        paySalaryComponent = (PaySalaryComponent) criteria.list().get(0);
    }

    return paySalaryComponent;
}

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

@Override
public List<PayTempKalkulasi> getByParamForDetail(String searchParameter, int firstResult, int maxResults,
        Order order, Long paySalaryComponentId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(searchParameter, criteria, paySalaryComponentId);
    criteria.addOrder(order);/*ww 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.PayTempKalkulasiEmpPajakDaoImpl.java

@Override
public List<PayTempKalkulasiEmpPajak> getByParamForDetail(String searchParameter, int firstResult,
        int maxResults, Order order, Long taxComponentId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(searchParameter, criteria, taxComponentId);
    criteria.addOrder(order);/*from   w w w.  j av a 2s. c o  m*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<PayTempOvertime> getByParam(PayTempOvertimeSearchParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(searchParameter, criteria);
    criteria.addOrder(order);/*from  w w w  . java2s . co  m*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<Position> getByParam(PositionSearchParameter searchParameter, int firstResult, int maxResults,
        Order order) {/*www.  jav  a 2  s.c  o m*/
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchPositiontByParam(searchParameter, criteria);
    criteria.setFetchMode("posBiaya", FetchMode.JOIN);
    criteria.setFetchMode("department", FetchMode.JOIN);
    criteria.setFetchMode("golonganJabatan", FetchMode.JOIN);
    criteria.setFetchMode("educationLevel", FetchMode.JOIN);
    criteria.setFetchMode("skJabatan", FetchMode.JOIN);
    criteria.setFetchMode("grade", FetchMode.JOIN);
    criteria.addOrder(order);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

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

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

@Override
public List<RecruitAdvertisementCategory> getByParam(
        RecruitAdvertisementCategorySearchParameter searchParameter, int firstResult, int maxResults,
        Order order) {//from w  ww.jav  a 2  s. c  om
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(searchParameter, criteria);
    criteria.addOrder(order);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}