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.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);/*  ww  w  .  j  a va 2s .  com*/
    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);//from  www. jav a  2 s.c  o m
    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  . j  a va  2 s .  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);//from   w w  w . j  av  a2s .c om
    criteria.setMaxResults(1);

    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);/*from   w ww.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.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 ww w .  j ava  2s .  com*/
    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  .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.PositionDaoImpl.java

@Override
public List<Position> getByParam(PositionSearchParameter searchParameter, int firstResult, int maxResults,
        Order order) {/*from   w  w  w . j a  v a2s  . com*/
    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);//w w  w  .j a va  2  s . c  o  m
    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  ww  w.  j  a  v a2 s . c o  m
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(searchParameter, criteria);
    criteria.addOrder(order);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}