Example usage for org.hibernate Criteria createAlias

List of usage examples for org.hibernate Criteria createAlias

Introduction

In this page you can find the example usage for org.hibernate Criteria createAlias.

Prototype

public Criteria createAlias(String associationPath, String alias) throws HibernateException;

Source Link

Document

Join an association, assigning an alias to the joined association.

Usage

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();
}

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

@Override
public PayTempOvertime getAllDataByNik(String nik) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("empData", "empData");
    criteria.add(Restrictions.eq("empData.nik", nik));
    return (PayTempOvertime) criteria.uniqueResult();
}

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

@Override
public List<RecruitmenSelectionSeriesDetail> getAllWithLetterSpesific(Integer letterType) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    if (letterType.equals(HRMConstant.LETTER_TYPE_OFFERING)) {
        criteria.createAlias("recruitLettersByAcceptLetterId", "ra");
        criteria.add(Restrictions.eq("ra.leterTypeId", letterType));
    }/*from w w w .ja va2 s.c o  m*/
    if (letterType.equals(HRMConstant.LETTER_TYPE_REJECT)) {
        criteria.createAlias("recruitLettersByRejectLetterId", "rj");
        criteria.add(Restrictions.eq("rj.leterTypeId", letterType));
    }

    return criteria.list();
}

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

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