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

@Override
public KlasifikasiKerjaLevel getEntityWithDetail(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("klasifikasiKerja", FetchMode.JOIN);
    criteria.setFetchMode("klasifikasiKerja.golonganJabatanByStrataAtasGoljabId", FetchMode.JOIN);
    criteria.setFetchMode("klasifikasiKerja.golonganJabatanByStrataBawahGoljabId", FetchMode.JOIN);
    criteria.setFetchMode("klasifikasiKerja.golonganJabatanByStrataAtasGoljabId.pangkat", FetchMode.JOIN);
    criteria.setFetchMode("klasifikasiKerja.golonganJabatanByStrataBawahGoljabId.pangkat", FetchMode.JOIN);
    criteria.add(Restrictions.eq("id", id));
    return (KlasifikasiKerjaLevel) criteria.uniqueResult();
}

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

@Override
public List<LoanCanceled> getByParam(LoanCanceledSearchParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());

    doSearchByParam(searchParameter, criteria);
    criteria.createAlias("loan", "loan", JoinType.INNER_JOIN);
    criteria.createAlias("loan.loanSchema", "loanSchema", JoinType.INNER_JOIN);
    criteria.setFetchMode("loan.empData", FetchMode.JOIN);
    criteria.setFetchMode("loan.empData.bioData", FetchMode.JOIN);
    criteria.add(Restrictions.eq("loan.statusPencairan", HRMConstant.LOAN_CANCELED));
    criteria.addOrder(order);/*ww  w.  java  2s .  c om*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public LoanCanceled getEntityByPkWithDetail(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("id", id));
    criteria.createAlias("loan", "loan", JoinType.INNER_JOIN);
    criteria.createAlias("loan.loanSchema", "loanSchema", JoinType.INNER_JOIN);
    criteria.setFetchMode("loan.empData", FetchMode.JOIN);
    criteria.setFetchMode("loan.empData.bioData", FetchMode.JOIN);
    return (LoanCanceled) criteria.uniqueResult();

}

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

@Override
public LoanNewApplication getEntityByIdWithDetail(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("loanNewSchema", FetchMode.JOIN);
    criteria.setFetchMode("loanNewType", FetchMode.JOIN);
    return (LoanNewApplication) criteria.uniqueResult();
}

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

@Override
public List<LoanNewApplication> getListUnpaidLoanByEmpDataIdAndLoanNewTypeId(Long empDataId,
        Long loanNewTypeId) {/*w  w  w  . ja  v  a  2 s .  c  om*/
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());

    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("loanNewType", FetchMode.JOIN);
    criteria.add(Restrictions.eq("empData.id", empDataId));
    criteria.add(Restrictions.eq("loanNewType.id", loanNewTypeId));
    criteria.add(Restrictions.ne("loanStatus", HRMConstant.LOAN_PAID));
    return criteria.list();
}

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

@Override
public List<LoanNewApplication> getListLoanDisbursedOrPaidByEmpDataIdAndLoanNewSchemaId(Long empDataId,
        Long loanNewSchemaId) {//  w  w w.j  a  v a  2s .  com
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());

    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("loanNewSchema", FetchMode.JOIN);
    criteria.add(Restrictions.eq("empData.id", empDataId));
    criteria.add(Restrictions.eq("loanNewSchema.id", loanNewSchemaId));

    Disjunction disjunction = Restrictions.disjunction();
    disjunction.add(Restrictions.eq("loanStatus", HRMConstant.LOAN_DISBURSED));
    disjunction.add(Restrictions.eq("loanStatus", HRMConstant.LOAN_PAID));
    criteria.add(disjunction);

    return criteria.list();
}

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

@Override
public List<LoanNewApplication> getByParamByStatusUndisbursed(LoanNewSearchParameter parameter, int firstResult,
        int maxResults, Order orderable) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(parameter, criteria);
    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("empData.bioData", FetchMode.JOIN);
    criteria.setFetchMode("loanNewSchema", FetchMode.JOIN);
    criteria.setFetchMode("loanNewType", FetchMode.JOIN);
    criteria.add(Restrictions.eq("loanStatus", HRMConstant.LOAN_UNDISBURSED));
    criteria.addOrder(orderable);/*from   w  w w .ja v  a  2 s .com*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<LoanNewApplication> getListLoanDisbursedOrPaidByEmpDataIdAndLoanNewTypeId(Long empDataId,
        Long loanNewTypeId) {/*from   ww w  .  ja  v  a2s .  c o m*/
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());

    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("loanNewType", FetchMode.JOIN);
    criteria.add(Restrictions.eq("empData.id", empDataId));
    criteria.add(Restrictions.eq("loanNewType.id", loanNewTypeId));

    Disjunction disjunction = Restrictions.disjunction();
    disjunction.add(Restrictions.eq("loanStatus", HRMConstant.LOAN_DISBURSED));
    disjunction.add(Restrictions.eq("loanStatus", HRMConstant.LOAN_PAID));
    criteria.add(disjunction);

    return criteria.list();
}

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

@Override
public LoanNewApplication getEntityWithDetailByActivityNumber(String activityNumber) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("approvalActivityNumber", activityNumber));
    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("empData.bioData", FetchMode.JOIN);
    criteria.setFetchMode("loanNewSchema", FetchMode.JOIN);
    criteria.setFetchMode("loanNewType", FetchMode.JOIN);
    return (LoanNewApplication) criteria.uniqueResult();
}

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

@Override
public List<LoanNewApplication> getListUnpaidLoanByEmpDataId(Long empDataId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());

    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("loanNewType", FetchMode.JOIN);
    criteria.add(Restrictions.eq("empData.id", empDataId));
    criteria.add(Restrictions.ne("loanStatus", HRMConstant.LOAN_PAID));
    criteria.add(Restrictions.ne("loanStatus", HRMConstant.LOAN_CANCELED));
    criteria.add(Restrictions.ne("loanStatus", HRMConstant.LOAN_REJECTED));
    criteria.add(Restrictions.ne("loanStatus", HRMConstant.LOAN_UNDISBURSED));
    return criteria.list();
}