Example usage for org.hibernate FetchMode JOIN

List of usage examples for org.hibernate FetchMode JOIN

Introduction

In this page you can find the example usage for org.hibernate FetchMode JOIN.

Prototype

FetchMode JOIN

To view the source code for org.hibernate FetchMode JOIN.

Click Source Link

Document

Fetch using an outer join.

Usage

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

@Override
public List<BioData> getByParam(BioDataSearchParameter parameter, int firstResult, int maxResults,
        Order orderable) {//w w  w  .  ja  v a2s .c o m
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchBioDataByParam(parameter, criteria);
    criteria.setFetchMode("religion", FetchMode.JOIN);
    criteria.setFetchMode("maritalStatus", FetchMode.JOIN);

    criteria.addOrder(orderable);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public BioData getEntityByPKWithDetail(long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("id", id));
    criteria.setFetchMode("city", FetchMode.JOIN);
    criteria.setFetchMode("race", FetchMode.JOIN);
    criteria.setFetchMode("religion", FetchMode.JOIN);
    criteria.setFetchMode("nationality", FetchMode.JOIN);
    criteria.setFetchMode("maritalStatus", FetchMode.JOIN);
    criteria.setFetchMode("dialect", FetchMode.JOIN);
    return (BioData) criteria.uniqueResult();
}

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

@Override
public BioEmergencyContact getEntityByPKWithDetail(long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("id", id));
    criteria.setFetchMode("city", FetchMode.JOIN);
    criteria.setFetchMode("familyRelation", FetchMode.JOIN);
    return (BioEmergencyContact) criteria.uniqueResult();
}

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

@Override
public List<BioEmergencyContact> getAllDataWithDetailByBioDataId(long bioDataId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("city", FetchMode.JOIN);
    criteria.setFetchMode("familyRelation", FetchMode.JOIN);
    criteria.setFetchMode("bioData", FetchMode.JOIN);
    criteria.add(Restrictions.eq("bioData.id", bioDataId));
    return criteria.list();
}

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

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

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

@Override
public List<BioSertifikasi> getAllDataByBioDataId(Long bioDataId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("biodata", FetchMode.JOIN);
    criteria.setFetchMode("educationNonFormal", FetchMode.JOIN);
    criteria.setFetchMode("occupationType", FetchMode.JOIN);
    criteria.add(Restrictions.eq("bioData.id", bioDataId));

    return criteria.list();
}

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

@Override
public BioSertifikasi getEntityByPKWithDetail(Long id) throws Exception {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("educationNonFormal", FetchMode.JOIN);
    criteria.setFetchMode("occupationType", FetchMode.JOIN);
    criteria.add(Restrictions.eq("id", id));
    return (BioSertifikasi) criteria.uniqueResult();
}

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

@Override
public CareerTerminationType getEntityWithDetailById(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("id", id));
    criteria.setFetchMode("systemLetterReference", FetchMode.JOIN);
    criteria.setFetchMode("systemCareerConst", FetchMode.JOIN);
    return (CareerTerminationType) criteria.uniqueResult();
}

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

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

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

@Override
public List<DepartementUploadCapture> getByMecineFingerId(long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("mecineFinger", "d");
    criteria.add(Restrictions.eq("d.id", id));
    criteria.addOrder(Order.asc("department"));
    criteria.setFetchMode("department", FetchMode.JOIN);
    return criteria.list();

}