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

@Override
public List<LoginHistory> getByParam(int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("hrmUser", "hrmUser", JoinType.LEFT_OUTER_JOIN);
    criteria.addOrder(order);/*from  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.LoginHistoryDaoImpl.java

@Override
public List<LoginHistory> getByParam(LoginHistorySearchParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchLoginHistByParam(searchParameter, criteria);
    criteria.createAlias("hrmUser", "hrmUser", JoinType.LEFT_OUTER_JOIN);
    criteria.addOrder(order);//ww w.  j av a 2  s .c o m
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<LogWtAttendanceRealization> getAllDataByParam(LogWtAttendanceRealizationModel model,
        int firstResult, int maxResults, Order orderable) {

    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    //      criteria.add(Restrictions.ge("periodeDateStart", model.getStartPeriod()));
    //      criteria.add(Restrictions.lt("periodeDateEnd", model.getEndPeriod()));
    if (model.getWtPeriodeId() != null) {
        criteria.add(Restrictions.eq("wtPeriodeId", model.getWtPeriodeId()));
    }// www.j a  va  2s  .  c om

    if (model.getListDeptName() != null && model.getListDeptName().size() > 0) {
        criteria.add(Restrictions.in("empDepartementName", model.getListDeptName()));
    }

    if (model.getListGolJabName() != null && model.getListGolJabName().size() > 0) {
        criteria.add(Restrictions.in("empGolJab", model.getListGolJabName()));
    }
    //        if (model.getListGolJabName() != null) {
    //            criteria.add(Restrictions.in("empGolJab", model.getListGolJabName()));
    //        }
    criteria.addOrder(orderable);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<MecineFinger> getByParam(MecineFingerSearchParameter parameter, int firstResult, int maxResults,
        Order orderable) {/*from www  .j  a  va 2 s  .  c om*/
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchMecineFingerByParam(parameter, criteria);
    criteria.addOrder(orderable);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<OhsaCategory> getByParam(OhsaCategorySearchParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(searchParameter, criteria);
    criteria.addOrder(order);//w  w  w.j a  v  a 2s.  co m
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<OhsaIncident> getByParam(OhsaIncidentSearchParameter parameter, int firstResult, int maxResults,
        Order orderable) {//ww w  . j ava2 s  . com
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    //   criteria.setFetchMode("ohsaCategory", FetchMode.JOIN);               
    doSearchByParam(parameter, criteria);

    criteria.addOrder(orderable);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);

    return criteria.list();
}

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

@Override
public List<OrgTypeOfSpecJabatan> getAllDataByJabatanId(Long id, int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("jabatan.id", id));
    criteria.setFetchMode("jabatan", FetchMode.JOIN);
    criteria.setFetchMode("orgTypeOfSpecList", FetchMode.JOIN);

    criteria.createAlias("jabatan", "jabatan", JoinType.INNER_JOIN);
    criteria.createAlias("orgTypeOfSpecList", "orgTypeOfSpecList", JoinType.INNER_JOIN);

    criteria.addOrder(order);/*from   w  w  w  .  j ava  2s  .  c om*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<OrgTypeOfSpecList> getByParam(OrgTypeOfSpecListSearchParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(searchParameter, criteria);
    criteria.addOrder(order);//from   ww w  .  j a va  2 s.c  o  m
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    criteria.setFetchMode("orgTypeOfSpec", FetchMode.JOIN);
    criteria.createAlias("orgTypeOfSpec", "orgTypeOfSpec", JoinType.INNER_JOIN);
    return criteria.list();
}

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

@Override
public List<OverTimeDistribution> getByParamWithDetail(OverTimeDistributionSearchParameter searchParameter,
        int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearch(searchParameter, criteria);
    //criteria.setFetchMode("empData", FetchMode.JOIN);
    //criteria.setFetchMode("empData.bioData", FetchMode.JOIN);
    //criteria.setFetchMode("wtOverTime", FetchMode.JOIN);
    criteria.addOrder(order);/*w w  w.ja  v  a 2s.c  om*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<PasswordHistory> getByParam(PasswordHistorySearchParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchPasswordHistByParam(searchParameter, criteria);
    //        criteria.createAlias("hrmUser", "hrmUser", JoinType.LEFT_OUTER_JOIN);
    criteria.addOrder(order);/*from w ww .j  av  a2s.  c om*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}