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

@Deprecated
public Criteria createAlias(String associationPath, String alias, int joinType) throws HibernateException;

Source Link

Document

Join an association using the specified join-type, assigning an alias to the joined association.

Usage

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

private void doSearchByParam(RecruitVacancySelectionSearchParameter searchParameter, Criteria criteria) {
    if (searchParameter.getCode() != null) {
        criteria.add(Restrictions.like("code", searchParameter.getCode(), MatchMode.START));
    }//from  www .j  a  va2 s. c o m
    if (searchParameter.getRecruitment() != null) {
        criteria.createAlias("recruitHireApply", "recruitHireApply", JoinType.INNER_JOIN);
        criteria.add(Restrictions.like("recruitHireApply.reqHireCode", searchParameter.getRecruitment(),
                MatchMode.START));
    }
    criteria.add(Restrictions.isNotNull("id"));
}

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

@Override
public List<RecruitVacancySelectionDetailPic> getAllDataByRecruitVacancySelectionDetailId(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());

    criteria.createAlias("recruitVacancySelectionDetail", "recruitVacancySelectionDetail", JoinType.INNER_JOIN);
    criteria.createAlias("recruitVacancySelectionDetail.recruitVacancySelection", "recruitVacancySelection",
            JoinType.INNER_JOIN);/*  ww w  .j  a  v  a2 s  .c om*/
    criteria.add(Restrictions.eq("recruitVacancySelectionDetail.id", id));
    criteria.setFetchMode("empData", FetchMode.JOIN);
    criteria.setFetchMode("empData.bioData", FetchMode.JOIN);
    criteria.setFetchMode("empData.jabatanByJabatanId", FetchMode.JOIN);
    criteria.setFetchMode("empData.jabatanByJabatanId.department", FetchMode.JOIN);
    criteria.setFetchMode("empData.employeeType", FetchMode.JOIN);
    return criteria.list();
}

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

private void doSearchByParam(SchedulerLogSearchParameter searchParameter, Criteria criteria) {
    criteria.createAlias("schedulerConfig", "schedulerConfig", JoinType.INNER_JOIN);
    if (StringUtils.isNotEmpty(searchParameter.getName())) {
        criteria.add(Restrictions.eq("schedulerConfig.name", searchParameter.getName()));
    }//from   ww  w.j av a2  s.  c o  m
    criteria.add(Restrictions.isNotNull("id"));
}

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

private void doSearchTempAttendanceRealizationByParam(TempAttendanceRealizationSearchParameter parameter,
        Criteria criteria) {
    if (parameter.getJabatan() != null) {
        criteria.createAlias("empData", "ce", JoinType.INNER_JOIN);
        criteria.createAlias("ce.jabatanByJabatanId", "jb", JoinType.INNER_JOIN);
        criteria.add(Restrictions.like("jb.name", parameter.getJabatan(), MatchMode.ANYWHERE));
    }/*from   w ww  . j  av  a  2s .  c  o  m*/

    if (parameter.getName() != null) {
        criteria.createAlias("empData", "ce", JoinType.INNER_JOIN);
        criteria.createAlias("ce.bioData", "bio", JoinType.INNER_JOIN);
        criteria.add(
                Restrictions.ilike("bio.combineName", parameter.getName().toLowerCase(), MatchMode.ANYWHERE));
    }
    if (parameter.getNik() != null) {
        criteria.createAlias("empData", "ce", JoinType.INNER_JOIN);
        criteria.add(Restrictions.like("ce.nik", parameter.getNik(), MatchMode.ANYWHERE));

    }
    if (parameter.getNoJab() != null) {
        criteria.createAlias("empData", "ce", JoinType.INNER_JOIN);
        criteria.createAlias("ce.jabatanByJabatanId", "jb", JoinType.INNER_JOIN);
        criteria.add(Restrictions.like("jb.code", parameter.getNoJab(), MatchMode.ANYWHERE));

    }
    criteria.add(Restrictions.isNotNull("id"));

}