List of usage examples for org.hibernate Criteria setMaxResults
public Criteria setMaxResults(int maxResults);
From source file:com.inkubator.hrm.dao.impl.JabatanDaoImpl.java
@Override public List<Jabatan> getByParam(JabatanSearchParameter searchParameter, int firstResult, int maxResults, Order order) {/*from ww w . j a v a 2s .c o m*/ 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);//from w w w .ja v a2 s.c om criteria.setMaxResults(7); 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);//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.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);/* w w w .j ava 2 s . c om*/ 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);// ww w . ja v a 2 s . co 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 .java 2 s.co m criteria.setFirstResult(firstResult); criteria.setMaxResults(maxResults); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.LoanNewApplicationInstallmentDaoImpl.java
@Override public LoanNewApplicationInstallment getLastPaidTerminInstallment(Integer LoanNewApplicationid) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.createAlias("loanNewApplication", "loanNewApplication", JoinType.INNER_JOIN); criteria.add(Restrictions.eq("loanNewApplication.id", LoanNewApplicationid)); DetachedCriteria criteriaWtPeriod = DetachedCriteria.forClass(WtPeriode.class) .add(Restrictions.eq("payrollType", HRMConstant.PERIODE_PAYROLL_ACTIVE)) .setProjection(Property.forName("fromPeriode")); criteria.add(Subqueries.propertyLt("installmentDate", criteriaWtPeriod)); criteria.addOrder(Order.desc("numOfInstallment")); criteria.setMaxResults(1); LoanNewApplicationInstallment currentNextInstallment = (LoanNewApplicationInstallment) criteria .uniqueResult();//from w w w. ja v a 2 s .co m return currentNextInstallment; }
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);/* 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.LoanNewTypeDaoImpl.java
@Override public List<LoanNewType> getByParam(LoanNewTypeSearchParameter parameter, int firstResult, int maxResults, Order orderable) {/*from w w w .j a v a 2 s .c om*/ 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 ww .j a v a 2 s . com 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(); }