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.LoanNewApplicationDaoImpl.java
@Override public LoanNewApplication getEntityWithDetailByActivityNumber(String activityNumber) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.add(Restrictions.eq("approvalActivityNumber", activityNumber)); 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> getListUnpaidLoanByEmpDataId(Long empDataId) { 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.ne("loanStatus", HRMConstant.LOAN_PAID)); criteria.add(Restrictions.ne("loanStatus", HRMConstant.LOAN_CANCELED)); criteria.add(Restrictions.ne("loanStatus", HRMConstant.LOAN_REJECTED)); criteria.add(Restrictions.ne("loanStatus", HRMConstant.LOAN_UNDISBURSED)); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.LoanNewApplicationInstallmentDaoImpl.java
@Override public Long getTotalInstallmentByLoanNewApplicationId(Integer loanNewApplicationId) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.setFetchMode("loanNewApplication", FetchMode.JOIN); criteria.add(Restrictions.eq("loanNewApplication.id", loanNewApplicationId)); return (Long) criteria.setProjection(Projections.rowCount()).uniqueResult(); }
From source file:com.inkubator.hrm.dao.impl.LoanNewSchemaDaoImpl.java
@Override public LoanNewSchema getEntityByPkFetchApprovalDefinition(Long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.add(Restrictions.eq("id", id)); criteria.setFetchMode("approvalDefinitionLoans", FetchMode.JOIN); criteria.setFetchMode("approvalDefinitionLoans.approvalDefinition", FetchMode.JOIN); return (LoanNewSchema) criteria.uniqueResult(); }
From source file:com.inkubator.hrm.dao.impl.LoanNewSchemaListOfEmpDaoImpl.java
@Override public LoanNewSchemaListOfEmp getEntityWithDetailByEmpDataId(Long empId) throws Exception { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.setFetchMode("empData", FetchMode.JOIN); criteria.setFetchMode("loanNewSchema", FetchMode.JOIN); criteria.add(Restrictions.eq("empData.id", empId)); return (LoanNewSchemaListOfEmp) criteria.uniqueResult(); }
From source file:com.inkubator.hrm.dao.impl.LoanNewSchemaListOfEmpDaoImpl.java
@Override public LoanNewSchemaListOfEmp getEntityByEmpDataId(Long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.add(Restrictions.eq("empData.id", id)); criteria.setFetchMode("loanNewSchema", FetchMode.JOIN); criteria.setFetchMode("empData", FetchMode.JOIN); criteria.setFetchMode("empData.bioData", FetchMode.JOIN); criteria.setFetchMode("empData.jabatanByJabatanId", FetchMode.JOIN); return (LoanNewSchemaListOfEmp) criteria.uniqueResult(); }
From source file:com.inkubator.hrm.dao.impl.LoanNewSchemaListOfTypeDaoImpl.java
@Override public List<LoanNewSchemaListOfType> getEntityByLoanNewSchema(Long loanNewSchema) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.createAlias("loanNewSchema", "loanNewSchema", JoinType.INNER_JOIN); criteria.add(Restrictions.eq("loanNewSchema.id", loanNewSchema)); criteria.setFetchMode("loanNewType", FetchMode.JOIN); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.LoanNewSchemaListOfTypeDaoImpl.java
@Override public LoanNewSchemaListOfType getEntityByIdWithDetail(Long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.add(Restrictions.eq("id", id)); criteria.setFetchMode("loanNewSchema", FetchMode.JOIN); criteria.setFetchMode("loanNewType", FetchMode.JOIN); return (LoanNewSchemaListOfType) criteria.uniqueResult(); }
From source file:com.inkubator.hrm.dao.impl.LoanNewSchemaListOfTypeDaoImpl.java
@Override public LoanNewSchemaListOfType getEntityByLoanNewSchemaIdAndLoanNewTypeIdWithDetail(Long loanNewSchemaId, Long loanNewTypeId) {//from w ww. j av a2 s. c om Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.setFetchMode("loanNewSchema", FetchMode.JOIN); criteria.setFetchMode("loanNewType", FetchMode.JOIN); criteria.add(Restrictions.eq("loanNewSchema.id", loanNewSchemaId)); criteria.add(Restrictions.eq("loanNewType.id", loanNewTypeId)); return (LoanNewSchemaListOfType) criteria.uniqueResult(); }
From source file:com.inkubator.hrm.dao.impl.LoanNewSchemaListOfTypeDaoImpl.java
@Override public List<LoanNewSchemaListOfType> getAllDataByLoanSchemaId(Long loanSchemaId) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.createAlias("loanNewSchema", "lns"); criteria.add(Restrictions.eq("lns.id", loanSchemaId)); criteria.addOrder(Order.desc("loanNewType")); criteria.setFetchMode("loanNewType", FetchMode.JOIN); return criteria.list(); }