Example usage for org.hibernate Criteria setFetchMode

List of usage examples for org.hibernate Criteria setFetchMode

Introduction

In this page you can find the example usage for org.hibernate Criteria setFetchMode.

Prototype

public Criteria setFetchMode(String associationPath, FetchMode mode) throws HibernateException;

Source Link

Document

Specify an association fetching strategy for an association or a collection of values.

Usage

From source file:com.inkubator.hrm.dao.impl.PaySalaryComponentEmployeeTypeDaoImpl.java

@Override
public List<PaySalaryEmpType> getEntityByPaySalaryComponentId(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("paySalaryComponent", FetchMode.JOIN);
    criteria.setFetchMode("employeeType", FetchMode.JOIN);
    criteria.add(Restrictions.eq("paySalaryComponent.id", id));
    return criteria.list();
}

From source file:com.inkubator.hrm.dao.impl.PaySalaryEmpTypeDaoImpl.java

@Override
public List<PaySalaryEmpType> getByUserId(long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("paySalaryComponent", "psc");
    criteria.add(Restrictions.eq("psc.id", id));
    criteria.addOrder(Order.desc("employeeType"));
    criteria.setFetchMode("employeeType", FetchMode.JOIN);
    return criteria.list();
}

From source file:com.inkubator.hrm.dao.impl.PayTempKalkulasiDaoImpl.java

@Override
public PayTempKalkulasi getEntityByPkWithDetail(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("id", id));
    criteria.setFetchMode("paySalaryComponent", FetchMode.JOIN);
    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("empData.bioData", FetchMode.JOIN);
    return (PayTempKalkulasi) criteria.uniqueResult();
}

From source file:com.inkubator.hrm.dao.impl.PayTempKalkulasiDaoImpl.java

@Override
public PayTempKalkulasi getEntityByEmpIdAndModelTakeHomePayId(Long empId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("empData", "empData", JoinType.INNER_JOIN);
    criteria.createAlias("paySalaryComponent", "paySalaryComponent", JoinType.INNER_JOIN);
    criteria.createAlias("paySalaryComponent.modelComponent", "modelComponent", JoinType.INNER_JOIN);
    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("empData.bioData", FetchMode.JOIN);
    criteria.setFetchMode("empData.golonganJabatan", FetchMode.JOIN);
    criteria.add(Restrictions.eq("empData.id", empId));
    criteria.add(Restrictions.eq("modelComponent.spesific", HRMConstant.MODEL_COMP_TAKE_HOME_PAY));
    return (PayTempKalkulasi) criteria.uniqueResult();
}

From source file:com.inkubator.hrm.dao.impl.PayTempKalkulasiDaoImpl.java

@Override
public List<PayTempKalkulasi> getAllDataByTotalIncomeBelow(BigDecimal nominal) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("paySalaryComponent", "paySalaryComponent", JoinType.INNER_JOIN);
    criteria.createAlias("paySalaryComponent.modelComponent", "modelComponent", JoinType.INNER_JOIN);
    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.add(Restrictions.eq("modelComponent.spesific", HRMConstant.MODEL_COMP_TAKE_HOME_PAY));
    criteria.add(Restrictions.lt("nominal", nominal));
    return criteria.list();
}

From source file:com.inkubator.hrm.dao.impl.PayTempOvertimeDaoImpl.java

@Override
public PayTempOvertime getEntityByPkWithDetail(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("empData.bioData", FetchMode.JOIN);
    criteria.add(Restrictions.eq("id", id));
    return (PayTempOvertime) criteria.uniqueResult();
}

From source file:com.inkubator.hrm.dao.impl.PositionDaoImpl.java

@Override
public List<Position> getByParam(PositionSearchParameter searchParameter, int firstResult, int maxResults,
        Order order) {/*  ww  w. j av  a 2 s  .c  o m*/
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchPositiontByParam(searchParameter, criteria);
    criteria.setFetchMode("posBiaya", FetchMode.JOIN);
    criteria.setFetchMode("department", FetchMode.JOIN);
    criteria.setFetchMode("golonganJabatan", FetchMode.JOIN);
    criteria.setFetchMode("educationLevel", FetchMode.JOIN);
    criteria.setFetchMode("skJabatan", FetchMode.JOIN);
    criteria.setFetchMode("grade", FetchMode.JOIN);
    criteria.addOrder(order);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

From source file:com.inkubator.hrm.dao.impl.RecruitAdvertisementMediaDaoImpl.java

@Override
public RecruitAdvertisementMedia getEntityByPkWithDetail(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("id", id));
    criteria.setFetchMode("recruitAdvertisementCategory", FetchMode.JOIN);
    return (RecruitAdvertisementMedia) criteria.uniqueResult();
}

From source file:com.inkubator.hrm.dao.impl.RecruitAgreementNoticeDaoImpl.java

@Override
public RecruitAgreementNotice getEntityByBioDataId(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("bioData.id", id));
    criteria.setFetchMode("bioData", FetchMode.JOIN);
    return (RecruitAgreementNotice) criteria.uniqueResult();
}

From source file:com.inkubator.hrm.dao.impl.RecruitHireApplyDetailDaoImpl.java

@Override
public List<RecruitHireApplyDetail> getListWithDetailByRecruitHireApplyId(Long recruitHireApplyId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("orgTypeOfSpecList", FetchMode.JOIN);
    criteria.setFetchMode("recruitHireApply", FetchMode.JOIN);
    criteria.add(Restrictions.eq("recruitHireApply.id", recruitHireApplyId));
    return criteria.list();
}