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

@Override
public RecruitLetters getByPkWithDetail(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("recruitLetterSelections", FetchMode.JOIN);
    criteria.setFetchMode("recruitLetterSelections.recruitSelectionType", FetchMode.JOIN);
    criteria.setFetchMode("recruitLetterComChannels", FetchMode.JOIN);
    criteria.setFetchMode("recruitLetterComChannels.recruitCommChannels", FetchMode.JOIN);
    return (RecruitLetters) criteria.uniqueResult();
}

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

@Override
public List<RecruitLetters> getByParam(RecrutimentLetterSearchParameter parameter, int firstResult,
        int maxResults, Order orderable) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchRecruitLettersByParam(parameter, criteria);
    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("empData.bioData", FetchMode.JOIN);
    criteria.addOrder(orderable);//from  www.  j av a2 s . c o m
    criteria.addOrder(orderable);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<RecruitmenSelectionSeriesDetail> getAllDataBySelectionSeriesId(Long id, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("recruitmenSelectionSeries.id", id));
    criteria.setFetchMode("recruitmenSelectionSeries", FetchMode.JOIN);
    criteria.setFetchMode("recruitSelectionType", FetchMode.JOIN);
    criteria.setFetchMode("recruitLettersByAcceptLetterId", FetchMode.JOIN);
    criteria.setFetchMode("recruitLettersByRejectLetterId", FetchMode.JOIN);
    criteria.addOrder(order);// ww  w .jav  a  2s .  c  om
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

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

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

@Override
public List<RecruitmenSelectionSeriesDetail> getListBySelectionSeriesId(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("recruitmenSelectionSeries", "recruitmenSelectionSeries", JoinType.INNER_JOIN);
    criteria.add(Restrictions.eq("recruitmenSelectionSeries.id", id));
    criteria.setFetchMode("recruitSelectionType", FetchMode.JOIN);
    return criteria.list();
}

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

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

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

@Override
public List<RecruitSelectionTypeTemplates> getByParentId(long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("recruitSelectionTypeTemplates", "dp", JoinType.INNER_JOIN);
    criteria.add(Restrictions.eq("dp.id", id));
    criteria.setFetchMode("recruitSelectionTypeTemplateses", FetchMode.JOIN);
    criteria.setFetchMode("recruitSelectionTypeTemplateses.recruitSelectionTypeTemplates", FetchMode.JOIN);
    criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    return criteria.list();
}

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

@Override
public RecruitSelectionTypeTemplates getByIdWithScore(long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("id", id));
    criteria.setFetchMode("systemScoring", FetchMode.JOIN);
    return (RecruitSelectionTypeTemplates) criteria.uniqueResult();
}

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

@Override
public List<RecruitSelectionTypeTemplatesJobTitle> getByRecruitSelectionTypeTemplatesId(long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("recruitSelectionTypeTemplates", "dp");
    criteria.add(Restrictions.eq("dp.id", id));
    criteria.addOrder(Order.desc("jabatan"));
    criteria.setFetchMode("recruitSelectionTypeTemplates", FetchMode.JOIN);
    return criteria.list();
}

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

@Override
public List<RecruitVacancySelection> getByParam(RecruitVacancySelectionSearchParameter searchParameter,
        int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(searchParameter, criteria);
    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);
    criteria.addOrder(order);//from   ww  w  .j av  a 2s  . c  o m
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}