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

@Override
public RecruitVacancySelection getEntityByPkWithDetail(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("id", id));
    criteria.setFetchMode("recruitHireApply", FetchMode.JOIN);
    criteria.setFetchMode("recruitHireApply.jabatan", FetchMode.JOIN);
    criteria.setFetchMode("recruitHireApply.employeeType", FetchMode.JOIN);
    criteria.setFetchMode("recruitHireApply.recruitMppPeriod", FetchMode.JOIN);
    criteria.setFetchMode("recruitmenSelectionSeries", FetchMode.JOIN);
    return (RecruitVacancySelection) criteria.uniqueResult();
}

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

@Override
public List<RecruitVacancySelectionDetail> getAllDataByRecruitVacancySelection(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("recruitVacancySelection.id", id));
    criteria.setFetchMode("recruitSelectionType", FetchMode.JOIN);
    return criteria.list();
}

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

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

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

@Override
public List<RecruitVacancySelectionDetailPic> getAllDataByRecruitVacancySelectionDetailId(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());

    criteria.createAlias("recruitVacancySelectionDetail", "recruitVacancySelectionDetail", JoinType.INNER_JOIN);
    criteria.createAlias("recruitVacancySelectionDetail.recruitVacancySelection", "recruitVacancySelection",
            JoinType.INNER_JOIN);/*from  w w  w.j  av  a 2 s . com*/
    criteria.add(Restrictions.eq("recruitVacancySelectionDetail.id", id));
    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("empData.bioData", FetchMode.JOIN);
    criteria.setFetchMode("empData.jabatanByJabatanId", FetchMode.JOIN);
    criteria.setFetchMode("empData.jabatanByJabatanId.department", FetchMode.JOIN);
    criteria.setFetchMode("empData.employeeType", FetchMode.JOIN);
    return criteria.list();
}

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

@Override
public List<RiwayatAkses> getRiwayatAksesByUserIdWithModel(String userID, int firstResult, int maxResults,
        Order order) {//from   w  w  w .ja  va  2  s. co m
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("userId", userID));
    criteria.addOrder(order);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    criteria.setFetchMode("hrmMenu", FetchMode.JOIN);
    return criteria.list();
}

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

@Override
public List<TempAttendanceRealization> getByParam(TempAttendanceRealizationSearchParameter parameter,
        int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchTempAttendanceRealizationByParam(parameter, criteria);
    criteria.addOrder(order);/*w w w . j av a 2 s .  c om*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("empData.jabatanByJabatanId", FetchMode.JOIN);
    criteria.setFetchMode("empData.bioData", FetchMode.JOIN);
    return criteria.list();
}

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

@Override
public List<TempJadwalKaryawan> getAllByEmpIdWithDetail(long empId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("empData", "e", JoinType.INNER_JOIN);
    criteria.add(Restrictions.eq("e.id", empId));
    criteria.setFetchMode("wtWorkingHour.attendanceStatus", FetchMode.JOIN);
    criteria.setFetchMode("wtWorkingHour", FetchMode.JOIN);
    criteria.addOrder(Order.asc("tanggalWaktuKerja"));
    return criteria.list();
}

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

@Override
public TempJadwalKaryawan getEntityByEmpDataIdAndTanggalWaktuKerja(Long id, Date implementationDate) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("empData", "empData", JoinType.INNER_JOIN);
    criteria.add(Restrictions.eq("empData.id", id));
    criteria.add(Restrictions.eq("tanggalWaktuKerja", implementationDate));
    criteria.setFetchMode("wtWorkingHour", FetchMode.JOIN);
    return (TempJadwalKaryawan) criteria.uniqueResult();
}

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

@Override
public TempJadwalKaryawan getByEmpId(Long id, Date implementationDate) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("empData", "empData", JoinType.INNER_JOIN);
    criteria.add(Restrictions.eq("empData.id", id));
    criteria.add(Restrictions.eq("tanggalWaktuKerja", implementationDate));
    criteria.setFetchMode("wtWorkingHour", FetchMode.JOIN);
    return (TempJadwalKaryawan) criteria.uniqueResult();
}

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

@Override
public List<TempJadwalKaryawan> getAllByEmpIdWithDetailWithFromAndUntilPeriod(long empId, Date from,
        Date until) {//from  www .java2 s . co m
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("empData", "e", JoinType.INNER_JOIN);
    criteria.add(Restrictions.eq("e.id", empId));
    criteria.add(Restrictions.ge("tanggalWaktuKerja", from));
    criteria.add(Restrictions.le("tanggalWaktuKerja", until));
    criteria.setFetchMode("wtWorkingHour.attendanceStatus", FetchMode.JOIN);
    criteria.setFetchMode("wtWorkingHour", FetchMode.JOIN);
    criteria.addOrder(Order.asc("tanggalWaktuKerja"));
    return criteria.list();
}