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

@Override
public List<OrgTypeOfSpecJabatan> getAllDataByJabatanId(Long id, int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("jabatan.id", id));
    criteria.setFetchMode("jabatan", FetchMode.JOIN);
    criteria.setFetchMode("orgTypeOfSpecList", FetchMode.JOIN);

    criteria.createAlias("jabatan", "jabatan", JoinType.INNER_JOIN);
    criteria.createAlias("orgTypeOfSpecList", "orgTypeOfSpecList", JoinType.INNER_JOIN);

    criteria.addOrder(order);/*from ww  w.j  a  v a 2s .  com*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public OrgTypeOfSpecJabatan getEntityByPK(OrgTypeOfSpecJabatanId id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("id", id));
    criteria.setFetchMode("orgTypeOfSpecList", FetchMode.JOIN);
    return (OrgTypeOfSpecJabatan) criteria.uniqueResult();
}

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

@Override
public List<OrgTypeOfSpecJabatan> getAllDataByJabatanId(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("jabatan.id", id));
    criteria.setFetchMode("jabatan", FetchMode.JOIN);
    criteria.setFetchMode("orgTypeOfSpecList", FetchMode.JOIN);

    criteria.createAlias("jabatan", "jabatan", JoinType.INNER_JOIN);
    criteria.createAlias("orgTypeOfSpecList", "orgTypeOfSpecList", JoinType.INNER_JOIN);

    return criteria.list();
}

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

@Override
public List<OrgTypeOfSpecList> getByParam(OrgTypeOfSpecListSearchParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(searchParameter, criteria);
    criteria.addOrder(order);/*from   w  w  w .  j  a  v  a  2  s.  c  o  m*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    criteria.setFetchMode("orgTypeOfSpec", FetchMode.JOIN);
    criteria.createAlias("orgTypeOfSpec", "orgTypeOfSpec", JoinType.INNER_JOIN);
    return criteria.list();
}

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

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

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

@Override
public List<OrgTypeOfSpecList> getAllDataByOrgTypeOfSpecIdAndOrderByCode(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("orgTypeOfSpec.id", id));
    criteria.setFetchMode("orgTypeOfSpec", FetchMode.JOIN);
    criteria.addOrder(Order.asc("code"));
    return criteria.list();
}

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

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

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

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

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

@Override
public List<OverTimeDistribution> getAllDataByIdWithDetail() {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("empData.bioData", FetchMode.JOIN);
    criteria.setFetchMode("wtOverTime", FetchMode.JOIN);
    return criteria.list();
}

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

@Override
public OverTimeDistribution getById(OverTimeDistributionId object) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("id", FetchMode.JOIN);
    criteria.add(Restrictions.eq("id", object));
    return (OverTimeDistribution) criteria.uniqueResult();
}