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

@Override
public PayComponentDataException getByPaySalaryComponentId(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("empData.bioData", FetchMode.JOIN);
    criteria.setFetchMode("paySalaryComponent", FetchMode.JOIN);
    criteria.add(Restrictions.eq("id", id));
    return (PayComponentDataException) criteria.uniqueResult();
}

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

@Override
public List<PayComponentDataException> getByPaySalaryComponent(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("empData.bioData", FetchMode.JOIN);
    criteria.setFetchMode("paySalaryComponent", FetchMode.JOIN);
    criteria.add(Restrictions.eq("paySalaryComponent.id", id));
    return criteria.list();
}

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

@Override
public List<PayReceiverBankAccount> getAllByEmpId(long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("empData", "ep");
    criteria.add(Restrictions.eq("ep.id", id));
    criteria.setFetchMode("bioBankAccount", FetchMode.JOIN);
    criteria.setFetchMode("bioBankAccount.bank", FetchMode.JOIN);
    criteria.setFetchMode("bioBankAccount.bank.bank", FetchMode.JOIN);
    return criteria.list();
}

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

@Override
public List<PayReceiverBankAccount> getAllDataWithDetail() {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("empData", "empData", JoinType.INNER_JOIN);
    criteria.createAlias("empData.bioData", "bioData", JoinType.INNER_JOIN);
    criteria.setFetchMode("bioBankAccount", FetchMode.JOIN);
    criteria.setFetchMode("bioBankAccount.bank", FetchMode.JOIN);
    criteria.addOrder(Order.asc("bioData.firstName"));
    return criteria.list();
}

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

@Override
public List<PaySalaryComponent> getAllDataByParamWithDetail(PaySalaryComponentSearchParameter searchParameter,
        int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("modelComponent", FetchMode.JOIN);
    criteria.setFetchMode("paySalaryJurnal", FetchMode.JOIN);
    criteria.setFetchMode("taxComponent", FetchMode.JOIN);
    doSearchByParam(searchParameter, criteria);
    criteria.addOrder(order);/*from w w w  .j  a va  2 s.  c om*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public PaySalaryComponent getEntityByPkWithDetail(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("modelComponent", FetchMode.JOIN);
    criteria.setFetchMode("paySalaryJurnal", FetchMode.JOIN);
    criteria.setFetchMode("taxComponent", FetchMode.JOIN);
    ;//from   ww  w. j a  v  a2  s .  c  o  m
    criteria.add(Restrictions.eq("id", id));
    return (PaySalaryComponent) criteria.uniqueResult();
}

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

@Override
public Long getTotalByModelComponentAndModelReferensi(Long modelComponentId, Integer modelReferensi) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("modelComponent", "modelComponent", JoinType.INNER_JOIN);
    criteria.setFetchMode("modelComponent", FetchMode.JOIN);
    criteria.add(Restrictions.eq("modelComponent.id", modelComponentId));
    criteria.add(Restrictions.eq("modelReffernsil", modelReferensi));
    return (Long) criteria.setProjection(Projections.rowCount()).uniqueResult();
}

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

@Override
public Long getTotalByModelComponentAndModelReferensiAndNotId(Long modelComponentId, Integer modelReferensi,
        Long id) {// ww  w  .j a va  2 s .  c o m
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("modelComponent", "modelComponent", JoinType.INNER_JOIN);
    criteria.setFetchMode("modelComponent", FetchMode.JOIN);
    criteria.add(Restrictions.eq("modelComponent.id", modelComponentId));
    criteria.add(Restrictions.eq("modelReffernsil", modelReferensi));
    criteria.add(Restrictions.ne("id", id));
    return (Long) criteria.setProjection(Projections.rowCount()).uniqueResult();
}

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

@Override
public List<PaySalaryEmpType> getEntityByPaySalaryComponentId(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("paySalaryComponent", FetchMode.JOIN);
    criteria.setFetchMode("employeeType", FetchMode.JOIN);
    criteria.add(Restrictions.eq("paySalaryComponent.id", id));
    return criteria.list();
}

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

@Override
public List<PaySalaryEmpType> getByUserId(long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("paySalaryComponent", "psc");
    criteria.add(Restrictions.eq("psc.id", id));
    criteria.addOrder(Order.desc("employeeType"));
    criteria.setFetchMode("employeeType", FetchMode.JOIN);
    return criteria.list();
}