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.UnregDepartementDaoImpl.java

@Override
public List<UnregDepartement> getAllDataByUnregSalaryId(Long unregSalaryId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("unregSalary", "us");
    criteria.setFetchMode("department", FetchMode.JOIN);
    criteria.add(Restrictions.eq("us.id", unregSalaryId));
    return criteria.list();
}

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

@Override
public List<UnregEmpReligion> getAllDataByUnregSalaryId(Long unregSalaryId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("unregSalary", "us");
    criteria.setFetchMode("religion", FetchMode.JOIN);
    criteria.add(Restrictions.eq("us.id", unregSalaryId));
    return criteria.list();
}

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

@Override
public List<UnregEmpType> getAllDataByUnregSalaryId(Long unregSalaryId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("unregSalary", "us");
    criteria.setFetchMode("employeeType", FetchMode.JOIN);
    criteria.add(Restrictions.eq("us.id", unregSalaryId));
    return criteria.list();
}

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

@Override
public List<UnregGender> getAllDataByUnregSalaryId(Long unregSalaryId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("unregSalary", "us");
    criteria.setFetchMode("gender", FetchMode.JOIN);
    criteria.add(Restrictions.eq("us.id", unregSalaryId));
    return criteria.list();
}

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

@Override
public List<UnregGoljab> getAllDataByUnregSalaryId(Long unregSalaryId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("unregSalary", "us");
    criteria.setFetchMode("golonganJabatan", FetchMode.JOIN);
    criteria.add(Restrictions.eq("us.id", unregSalaryId));
    return criteria.list();
}

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

@Override
public List<UnregSalary> getByParam(UnregSalarySearchParameter searchParameter, int firstResult, int maxResults,
        Order order) {//from w  w w  .j  a v  a 2 s . c om
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("wtPeriode", FetchMode.JOIN);
    doSearchByParam(searchParameter, criteria);
    criteria.addOrder(order);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

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

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

@Override
public List<WtFingerException> getByParamWithDetail(WtFingerExceptionSearchParameter searchParameter,
        int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearch(searchParameter, criteria);
    criteria.setFetchMode("empData.employeeType", FetchMode.JOIN);
    criteria.addOrder(order);/*from   w  w  w.j a  v a  2s . c  o m*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

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

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

@Override
public WtGroupWorking getByPKIdWithDetail(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("id", id));
    criteria.setFetchMode("wtScheduleShifts", FetchMode.JOIN);
    criteria.setFetchMode("empDatas", FetchMode.JOIN);
    return (WtGroupWorking) criteria.uniqueResult();
}