List of usage examples for org.hibernate Criteria setFetchMode
public Criteria setFetchMode(String associationPath, FetchMode mode) throws HibernateException;
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public EmpData getEmpDataWithBioDataAndMaritalStatusById(long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.add(Restrictions.eq("id", id)); criteria.setFetchMode("bioData", FetchMode.JOIN); criteria.setFetchMode("bioData.maritalStatus", FetchMode.JOIN); criteria.setFetchMode("bioData.city", FetchMode.JOIN); return (EmpData) criteria.uniqueResult(); }
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public EmpData getByBioDataWithDepartment(long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.add(Restrictions.eq("bioData.id", id)); criteria.setFetchMode("bioData", FetchMode.JOIN); criteria.setFetchMode("jabatanByJabatanGajiId", FetchMode.JOIN); criteria.setFetchMode("jabatanByJabatanGajiId.department", FetchMode.JOIN); return (EmpData) criteria.uniqueResult(); }
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public EmpData getByIdWithDetail(long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.add(Restrictions.eq("id", id)); criteria.setFetchMode("bioData", FetchMode.JOIN); criteria.setFetchMode("jabatanByJabatanId", FetchMode.JOIN); criteria.setFetchMode("golonganJabatan", FetchMode.JOIN); criteria.setFetchMode("golonganJabatan.pangkat", FetchMode.JOIN); return (EmpData) criteria.uniqueResult(); }
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public List<EmpData> getEmpDataByListId(List<Long> data) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.add(Restrictions.in("id", data)); criteria.setFetchMode("jabatanByJabatanGajiId", FetchMode.JOIN); criteria.setFetchMode("bioData", FetchMode.JOIN); criteria.setFetchMode("jabatanByJabatanGajiId.department", FetchMode.JOIN); criteria.setFetchMode("jabatanByJabatanGajiId.unitKerja", FetchMode.JOIN); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public EmpData getEmpDataWithBiodata(Long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.add(Restrictions.eq("id", id)); criteria.createAlias("bioData", "bioData", JoinType.INNER_JOIN); criteria.createAlias("bioData.maritalStatus", "maritalStatus", JoinType.INNER_JOIN); criteria.setFetchMode("bioData", FetchMode.JOIN); criteria.setFetchMode("maritalStatus", FetchMode.JOIN); return (EmpData) criteria.uniqueResult(); }
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public EmpData getByPKBankTransfer(long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.add(Restrictions.eq("id", id)); criteria.setFetchMode("golonganJabatan", FetchMode.JOIN); criteria.setFetchMode("bioData", FetchMode.JOIN); criteria.setFetchMode("bioData.bioBankAccounts", FetchMode.JOIN); criteria.setFetchMode("bioData.bioBankAccounts.bank", FetchMode.JOIN); return (EmpData) criteria.uniqueResult(); }
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public EmpData getByEmpDataByBioDataId(long bioDataid) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.createAlias("bioData", "bioData", JoinType.INNER_JOIN); criteria.setFetchMode("bioData", FetchMode.JOIN); criteria.setFetchMode("jabatanByJabatanId", FetchMode.JOIN); criteria.setFetchMode("jabatanByJabatanId.department", FetchMode.JOIN); criteria.setFetchMode("jabatanByJabatanId.department.company", FetchMode.JOIN); criteria.setFetchMode("employeeType", FetchMode.JOIN); criteria.setFetchMode("golonganJabatan", FetchMode.JOIN); criteria.setFetchMode("golonganJabatan.pangkat", FetchMode.JOIN); criteria.add(Restrictions.eq("bioData.id", bioDataid)); return (EmpData) criteria.uniqueResult(); }
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()); /**/*from w w w . j a v a 2 s .c om*/ * 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 Boolean isEmpDataWithNullWtGroupWorkingExist() { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.setFetchMode("wtGroupWorking", FetchMode.JOIN); criteria.add(Restrictions.isNull("wtGroupWorking")); criteria.add(Restrictions.not(Restrictions.eq("status", HRMConstant.EMP_TERMINATION))); return !criteria.list().isEmpty(); }
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
@Override public List<EmpData> getAllDataByParam(EmpDataSearchParameter searchParameter, int firstResult, int maxResults, Order order) {//from w w w . ja v a 2s.co 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(); }