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.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 ww w . j a v a2 s . c o m*/ criteria.setFirstResult(firstResult); criteria.setMaxResults(maxResults); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.KlasifikasiKerjaJabatanDaoImpl.java
@Override public List<KlasifikasiKerjaJabatan> getByJabatanId(long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.createAlias("jabatan", "jb"); criteria.add(Restrictions.eq("jb.id", id)); criteria.addOrder(Order.desc("klasifikasiKerja")); criteria.setFetchMode("klasifikasiKerja", FetchMode.JOIN); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.KlasifikasiKerjaLevelDaoImpl.java
@Override public KlasifikasiKerjaLevel getEntityWithDetail(Long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.setFetchMode("klasifikasiKerja", FetchMode.JOIN); criteria.setFetchMode("klasifikasiKerja.golonganJabatanByStrataAtasGoljabId", FetchMode.JOIN); criteria.setFetchMode("klasifikasiKerja.golonganJabatanByStrataBawahGoljabId", FetchMode.JOIN); criteria.setFetchMode("klasifikasiKerja.golonganJabatanByStrataAtasGoljabId.pangkat", FetchMode.JOIN); criteria.setFetchMode("klasifikasiKerja.golonganJabatanByStrataBawahGoljabId.pangkat", FetchMode.JOIN); criteria.add(Restrictions.eq("id", id)); return (KlasifikasiKerjaLevel) criteria.uniqueResult(); }
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);/* w ww . 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.LoanCanceledDaoImpl.java
@Override public LoanCanceled getEntityByPkWithDetail(Long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.add(Restrictions.eq("id", id)); 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); return (LoanCanceled) criteria.uniqueResult(); }
From source file:com.inkubator.hrm.dao.impl.LoanNewApplicationDaoImpl.java
@Override public LoanNewApplication getEntityByIdWithDetail(Long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.add(Restrictions.eq("id", id)); criteria.setFetchMode("empData", FetchMode.JOIN); criteria.setFetchMode("empData.bioData", FetchMode.JOIN); criteria.setFetchMode("loanNewSchema", FetchMode.JOIN); criteria.setFetchMode("loanNewType", FetchMode.JOIN); return (LoanNewApplication) criteria.uniqueResult(); }
From source file:com.inkubator.hrm.dao.impl.LoanNewApplicationDaoImpl.java
@Override public List<LoanNewApplication> getListUnpaidLoanByEmpDataIdAndLoanNewTypeId(Long empDataId, Long loanNewTypeId) {/*from w w w. j a v a2 s. c o m*/ Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.setFetchMode("empData", FetchMode.JOIN); criteria.setFetchMode("loanNewType", FetchMode.JOIN); criteria.add(Restrictions.eq("empData.id", empDataId)); criteria.add(Restrictions.eq("loanNewType.id", loanNewTypeId)); criteria.add(Restrictions.ne("loanStatus", HRMConstant.LOAN_PAID)); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.LoanNewApplicationDaoImpl.java
@Override public List<LoanNewApplication> getListLoanDisbursedOrPaidByEmpDataIdAndLoanNewSchemaId(Long empDataId, Long loanNewSchemaId) {/* w w w. j a v a 2 s . c om*/ Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.setFetchMode("empData", FetchMode.JOIN); criteria.setFetchMode("loanNewSchema", FetchMode.JOIN); criteria.add(Restrictions.eq("empData.id", empDataId)); criteria.add(Restrictions.eq("loanNewSchema.id", loanNewSchemaId)); Disjunction disjunction = Restrictions.disjunction(); disjunction.add(Restrictions.eq("loanStatus", HRMConstant.LOAN_DISBURSED)); disjunction.add(Restrictions.eq("loanStatus", HRMConstant.LOAN_PAID)); criteria.add(disjunction); 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);//www .j a v a2s . c o m criteria.setFirstResult(firstResult); criteria.setMaxResults(maxResults); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.LoanNewApplicationDaoImpl.java
@Override public List<LoanNewApplication> getListLoanDisbursedOrPaidByEmpDataIdAndLoanNewTypeId(Long empDataId, Long loanNewTypeId) {// w w w . j av a2 s .c o m Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.setFetchMode("empData", FetchMode.JOIN); criteria.setFetchMode("loanNewType", FetchMode.JOIN); criteria.add(Restrictions.eq("empData.id", empDataId)); criteria.add(Restrictions.eq("loanNewType.id", loanNewTypeId)); Disjunction disjunction = Restrictions.disjunction(); disjunction.add(Restrictions.eq("loanStatus", HRMConstant.LOAN_DISBURSED)); disjunction.add(Restrictions.eq("loanStatus", HRMConstant.LOAN_PAID)); criteria.add(disjunction); return criteria.list(); }