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

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

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

@Override
public List<RecruitLetters> getByParam(RecrutimentLetterSearchParameter parameter, int firstResult,
        int maxResults, Order orderable) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchRecruitLettersByParam(parameter, criteria);
    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("empData.bioData", FetchMode.JOIN);
    criteria.addOrder(orderable);// w ww  . j a va2 s.c o  m
    criteria.addOrder(orderable);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public RecruitLetters getEntityMostUpdatedByLetterTypeId(Integer letterTypeId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("leterTypeId", letterTypeId));
    criteria.addOrder(Order.desc("createdOn"));
    criteria.setMaxResults(1);

    RecruitLetters entity = null;/*from   w  ww. j  a v a  2 s.  c  om*/
    List<RecruitLetters> list = criteria.list();
    if (!list.isEmpty()) {
        entity = list.get(0);
    }
    return entity;
}

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

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

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

@Override
public List<RecruitmenSelectionSeriesDetail> getByParam(int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.addOrder(order);/*from 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.RecruitmenSelectionSeriesDetailDaoImpl.java

@Override
public List<RecruitmenSelectionSeriesDetail> getAllDataBySelectionSeriesId(Long id, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("recruitmenSelectionSeries.id", id));
    criteria.setFetchMode("recruitmenSelectionSeries", FetchMode.JOIN);
    criteria.setFetchMode("recruitSelectionType", FetchMode.JOIN);
    criteria.setFetchMode("recruitLettersByAcceptLetterId", FetchMode.JOIN);
    criteria.setFetchMode("recruitLettersByRejectLetterId", FetchMode.JOIN);
    criteria.addOrder(order);/*  w w  w  .  java 2 s  . c  om*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

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

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

@Override
public List<RecruitVacancySelection> getByParam(RecruitVacancySelectionSearchParameter searchParameter,
        int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(searchParameter, criteria);
    criteria.setFetchMode("recruitHireApply", FetchMode.JOIN);
    criteria.setFetchMode("recruitHireApply.jabatan", FetchMode.JOIN);
    criteria.setFetchMode("recruitHireApply.employeeType", FetchMode.JOIN);
    criteria.setFetchMode("recruitHireApply.recruitMppPeriod", FetchMode.JOIN);
    criteria.setFetchMode("recruitmenSelectionSeries", FetchMode.JOIN);
    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.RiwayatAksesDaoImpl.java

@Override
public List<RiwayatAkses> getDataByUserId(String userID, int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("userId", userID));
    criteria.addOrder(order);//from   w w w.  j  a v a  2s. c o  m
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<RiwayatAkses> getRiwayatAksesByUserIdWithModel(String userID, int firstResult, int maxResults,
        Order order) {/*from  ww w  .jav  a2s  .  c  o  m*/
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("userId", userID));
    criteria.addOrder(order);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    criteria.setFetchMode("hrmMenu", FetchMode.JOIN);
    return criteria.list();
}