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

@Override
public Long getTotalInstallmentByLoanNewApplicationId(Integer loanNewApplicationId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("loanNewApplication", FetchMode.JOIN);
    criteria.add(Restrictions.eq("loanNewApplication.id", loanNewApplicationId));
    return (Long) criteria.setProjection(Projections.rowCount()).uniqueResult();
}

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

@Override
public LoanNewSchema getEntityByPkFetchApprovalDefinition(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("id", id));
    criteria.setFetchMode("approvalDefinitionLoans", FetchMode.JOIN);
    criteria.setFetchMode("approvalDefinitionLoans.approvalDefinition", FetchMode.JOIN);
    return (LoanNewSchema) criteria.uniqueResult();

}

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

@Override
public LoanNewSchemaListOfEmp getEntityWithDetailByEmpDataId(Long empId) throws Exception {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("loanNewSchema", FetchMode.JOIN);
    criteria.add(Restrictions.eq("empData.id", empId));
    return (LoanNewSchemaListOfEmp) criteria.uniqueResult();
}

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

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

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

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

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

@Override
public LoanNewSchemaListOfType getEntityByIdWithDetail(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("id", id));
    criteria.setFetchMode("loanNewSchema", FetchMode.JOIN);
    criteria.setFetchMode("loanNewType", FetchMode.JOIN);
    return (LoanNewSchemaListOfType) criteria.uniqueResult();
}

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

@Override
public LoanNewSchemaListOfType getEntityByLoanNewSchemaIdAndLoanNewTypeIdWithDetail(Long loanNewSchemaId,
        Long loanNewTypeId) {//from   w  w  w. ja v  a  2s . c o  m
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());

    criteria.setFetchMode("loanNewSchema", FetchMode.JOIN);
    criteria.setFetchMode("loanNewType", FetchMode.JOIN);
    criteria.add(Restrictions.eq("loanNewSchema.id", loanNewSchemaId));
    criteria.add(Restrictions.eq("loanNewType.id", loanNewTypeId));
    return (LoanNewSchemaListOfType) criteria.uniqueResult();
}

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

@Override
public List<LoanNewSchemaListOfType> getAllDataByLoanSchemaId(Long loanSchemaId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("loanNewSchema", "lns");
    criteria.add(Restrictions.eq("lns.id", loanSchemaId));
    criteria.addOrder(Order.desc("loanNewType"));
    criteria.setFetchMode("loanNewType", FetchMode.JOIN);
    return criteria.list();
}

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

@Override
public List<LoanNewSchemaListOfType> getEntityByLoanNewSchemaWhereStatusActive(Long loanNewSchema) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("loanNewSchema", "loanNewSchema", JoinType.INNER_JOIN);
    criteria.add(Restrictions.eq("loanNewSchema.id", loanNewSchema));
    criteria.add(Restrictions.eq("isActive", Boolean.TRUE));
    criteria.setFetchMode("loanNewType", FetchMode.JOIN);
    return criteria.list();
}

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

@Override
public LoanNewSchemaListOfType getEntityByLoanNewTypeIdWithDetail(Long loanNewTypeId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.setFetchMode("loanNewSchema", FetchMode.JOIN);
    criteria.setFetchMode("loanNewType", FetchMode.JOIN);
    criteria.add(Restrictions.eq("loanNewType.id", loanNewTypeId));
    criteria.add(Restrictions.eq("isActive", Boolean.TRUE));
    return (LoanNewSchemaListOfType) criteria.uniqueResult();
}