List of usage examples for org.hibernate Criteria setFirstResult
public Criteria setFirstResult(int firstResult);
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public List<EmpData> getAllDataReportEmpWorkingGroupByParam(ReportEmpWorkingGroupParameter param, int firstResult, int maxResults, Order orderable) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.createAlias("bioData", "bioData", JoinType.INNER_JOIN); criteria.createAlias("wtGroupWorking", "wtGroupWorking", JoinType.LEFT_OUTER_JOIN); doSearchReportEmpWorkingGroupByParam(param, criteria); criteria.addOrder(orderable);/* w w w.j a va2s.c o m*/ criteria.setFirstResult(firstResult); criteria.setMaxResults(maxResults); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public List<EmpData> getAllDataReportEmpDepartmentJabatanByParam(ReportEmpDepartmentJabatanParameter param, int firstResult, int maxResults, Order orderable) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.createAlias("bioData", "bioData", JoinType.INNER_JOIN); criteria.createAlias("golonganJabatan", "goljab", JoinType.INNER_JOIN); doSearchReportEmpDepartmentJabatanByParam(param, criteria); criteria.addOrder(orderable);/* ww w . j a v a 2 s . c o m*/ criteria.setFirstResult(firstResult); criteria.setMaxResults(maxResults); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public List<EmpData> getAllDataSalaryConfirmationByParam(SalaryConfirmationParameter param, int firstResult, int maxResults, Order orderable) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); this.doSearchSalaryConfirmationByParam(param, criteria); criteria.addOrder(orderable);/*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.EmpDataDaoImpl.java
@Override public List<EmpData> getAllDataByDepartementAndEducation(List<Long> departementId, List<Long> educationId, int firstResult, int maxResults, Order order) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); doCreateAliasByDepartmentAndEducation(departementId, educationId, criteria); criteria.setFirstResult(firstResult); criteria.setMaxResults(maxResults);/*ww w . ja v a2s. c om*/ criteria.addOrder(order); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public List<EmpData> getReportRekapJabatanByParam(List<Long> listDepartmentId, List<Long> listEmpTypeId, int firstResult, int maxResults, Order order) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); doCreateAliasByDepartmentAndEmployeeType(listDepartmentId, listEmpTypeId, criteria); criteria.setFirstResult(firstResult); criteria.setMaxResults(maxResults);/*www .j a v a 2s.c o m*/ criteria.addOrder(order); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public List<EmpData> getAllDataByParamWithDetail(List<Department> deptId, List<GolonganJabatan> golJabId, String[] empTypeName, List<Integer> listAge, List<Integer> listJoinDate, List<String> listNik, int firstResult, int maxResults, Order order) { List<Long> listDepartment = new ArrayList<Long>(); List<Long> listGolJab = new ArrayList<Long>(); for (Department department : deptId) { listDepartment.add(department.getId()); }//from ww w .j ava 2 s.c o m for (GolonganJabatan golonganJabatan : golJabId) { listGolJab.add(golonganJabatan.getId()); } final org.hibernate.type.Type[] typeJoinDate = new org.hibernate.type.Type[listJoinDate.size()]; Arrays.fill(typeJoinDate, org.hibernate.type.StandardBasicTypes.INTEGER); final org.hibernate.type.Type[] typeAge = new org.hibernate.type.Type[listAge.size()]; Arrays.fill(typeAge, org.hibernate.type.StandardBasicTypes.INTEGER); final StringBuilder joinDateList = new StringBuilder(); final StringBuilder ageList = new StringBuilder(); for (int i = 0; i < listJoinDate.size(); i++) { if (i > 0) { joinDateList.append(","); } joinDateList.append("?"); } for (int i = 0; i < listAge.size(); i++) { if (i > 0) { ageList.append(","); } ageList.append("?"); } Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); /** * automatically get relations of jabatanByJabatanId, 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.not(Restrictions.eq("status", HRMConstant.EMP_TERMINATION))); // criteria.createAlias("bioData", "bioData", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("golonganJabatan", "golonganJabatan", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("employeeType", "employeeType", JoinType.LEFT_OUTER_JOIN); // criteria.createCriteria("bioData", "bio", JoinType.LEFT_OUTER_JOIN); if (!deptId.isEmpty()) { criteria.add(Restrictions.in("department.id", listDepartment)); } if (!golJabId.isEmpty()) { criteria.add(Restrictions.in("golonganJabatan.id", listGolJab)); } if (empTypeName.length != 0) { criteria.add(Restrictions.in("employeeType.name", empTypeName)); } if (listJoinDate.get(0) != 0) { criteria.add(Restrictions .sqlRestriction("DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS({alias}.join_date)), '%Y')+0 in (" + joinDateList.toString() + ")", listJoinDate.toArray(), typeJoinDate)); } if (listAge.get(0) != 0) { // criteria.createAlias("bioData", "bioData", JoinType.LEFT_OUTER_JOIN); Criteria criteriaBiodata = criteria.createCriteria("bioData", JoinType.LEFT_OUTER_JOIN); // criteria.createCriteria("bioData", JoinType.LEFT_OUTER_JOIN); criteriaBiodata.add(Restrictions.sqlRestriction( "DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS({alias}.date_of_birth)), '%Y')+0 in (" + ageList.toString() + ")", listAge.toArray(), typeAge)); } if (!listNik.isEmpty()) { criteria.add(Restrictions.in("nik", listNik)); } criteria.addOrder(order); criteria.setFirstResult(firstResult); criteria.setMaxResults(maxResults); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public List<EmpData> getAllDataByEmployeeTypeOrGolonganJabatanOrUnitKerja(List<Long> empTypeId, List<Long> golJabId, List<Long> unitKerjaId, int firstResult, int maxResults, Order order) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); /**/* w w w .ja v a2s.co m*/ * automatically get relations of jabatanByJabatanId, 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.not(Restrictions.eq("status", HRMConstant.EMP_TERMINATION))); criteria.createAlias("jabatanByJabatanId.unitKerja", "unitKerja", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("jabatanByJabatanId.golonganJabatan", "goljab", JoinType.LEFT_OUTER_JOIN); // criteria.createAlias("department.company", "company", JoinType.LEFT_OUTER_JOIN); criteria.createAlias("employeeType", "employeeType", JoinType.LEFT_OUTER_JOIN); criteria.setFetchMode("bioData", FetchMode.JOIN); if (!empTypeId.isEmpty()) { criteria.add(Restrictions.in("employeeType.id", empTypeId)); } if (!golJabId.isEmpty()) { criteria.add(Restrictions.in("goljab.id", golJabId)); } if (!unitKerjaId.isEmpty()) { criteria.add(Restrictions.in("unitKerja.id", unitKerjaId)); } criteria.addOrder(order); criteria.setFirstResult(firstResult); criteria.setMaxResults(maxResults); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public List<EmpData> getByParam(String nikOrNameSearchParameter, int firstResult, int maxResults, Order order) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); doSearchEmpDataByParam(nikOrNameSearchParameter, criteria); criteria.addOrder(order);/* w w w . jav a2 s . c o m*/ criteria.setFirstResult(firstResult); criteria.setMaxResults(maxResults); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public List<EmpData> getAllDataNotTerminatePaging(TempAttendanceRealizationSearchParameter parameter, int firstResult, int maxResult, Order order) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.add(Restrictions.not(Restrictions.eq("status", HRMConstant.EMP_TERMINATION))); if (parameter.getNik() != null) { criteria.add(Restrictions.like("nik", parameter.getNik(), MatchMode.ANYWHERE)); }// www . j av a2 s.c om criteria.createAlias("bioData", "bio", JoinType.INNER_JOIN); if (parameter.getName() != null) { // criteria.createAlias("bioData", "bio", JoinType.INNER_JOIN); Disjunction orCondition = Restrictions.disjunction(); orCondition.add( Restrictions.ilike("bio.combineName", parameter.getName().toLowerCase(), MatchMode.ANYWHERE)); orCondition.add(Restrictions.like("nik", parameter.getName(), MatchMode.ANYWHERE)); criteria.add(orCondition); } //String sorting = "bio." + order; criteria.addOrder(order); // if (order==null) { // criteria.addOrder(order); // } else { // if (order.isAscending()) { // // criteria.addOrder(Order.asc(sorting)); // } else { // // criteria.addOrder(Order.desc(sorting)); // } // } criteria.setFirstResult(firstResult); criteria.setMaxResults(maxResult); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public List<EmpData> getAllDataByParam(EmpDataSearchParameter searchParameter, int firstResult, int maxResults, Order order) {//from ww w .j a v a 2 s.c o m Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.createAlias("golonganJabatan", "golonganJabatan", JoinType.LEFT_OUTER_JOIN); // criteria.createAlias("taxFree", "taxFree", JoinType.INNER_JOIN); criteria.setFetchMode("bioData.city", FetchMode.JOIN); criteria.setFetchMode("bioData.maritalStatus", FetchMode.JOIN); criteria.setFetchMode("golonganJabatan.pangkat", FetchMode.JOIN); criteria.setFetchMode("jabatanByJabatanId.department", FetchMode.JOIN); criteria.setFetchMode("jabatanByJabatanId.unitKerja", FetchMode.JOIN); criteria.setFetchMode("wtGroupWorking", FetchMode.JOIN); doSearchByParam(searchParameter, criteria); criteria.addOrder(order); criteria.setFirstResult(firstResult); criteria.setMaxResults(maxResults); return criteria.list(); }