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

private void doSearchByParam(PayTempOvertimeSearchParameter searchParameter, Criteria criteria) {
    criteria.createAlias("empData", "empData", JoinType.INNER_JOIN);
    criteria.createAlias("empData.bioData", "bioData", JoinType.INNER_JOIN);
    if (searchParameter.getEmployeeName() != null) {
        //            criteria.add(Restrictions.like("bioData.firstName", searchParameter.getEmployeeName(), MatchMode.ANYWHERE));
        criteria.add(Restrictions.ilike("bioData.combineName", searchParameter.getEmployeeName().toLowerCase(),
                MatchMode.ANYWHERE));/*from   w ww  . j a  v  a  2s  .  c o  m*/
    }
    if (searchParameter.getNim() != null) {
        criteria.add(Restrictions.like("empData.nik", searchParameter.getNim(), MatchMode.START));
    }
    criteria.add(Restrictions.isNotNull("id"));
}

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

private void doSearchPositiontByParam(PositionSearchParameter searchParameter, Criteria criteria) {
    if (searchParameter.getCostCenterName() != null) {

        criteria.add(Restrictions.eq("po.posBiayaName", searchParameter.getCostCenterName()));
    }/* w  ww. ja v a2 s  .c o m*/
    if (searchParameter.getCostCenterCode() != null || searchParameter.getCostCenterName() != null) {
        criteria.createAlias("posBiaya", "po", JoinType.INNER_JOIN);
    }
    if (searchParameter.getCostCenterCode() != null) {
        criteria.add(Restrictions.eq("po.posBiayaCode", searchParameter.getCostCenterCode()));
    }

    if (searchParameter.getDepartementName() != null) {
        criteria.createAlias("department", "d", JoinType.INNER_JOIN);
        criteria.add(Restrictions.eq("d.departmentName", searchParameter.getDepartementName()));
    }
    if (searchParameter.getEducationName() != null) {
        criteria.createAlias("educationLevel", "ed", JoinType.INNER_JOIN);
        criteria.add(Restrictions.eq("ed.pendidikanLevelName", searchParameter.getEducationName()));
    }
    if (searchParameter.getNomorSk() != null) {
        criteria.createAlias("skJabatan", "sk", JoinType.INNER_JOIN);
        criteria.add(Restrictions.eq("sk.skNomor", searchParameter.getNomorSk()));
    }

    if (searchParameter.getParentCode() != null) {
        criteria.add(Restrictions.eq("position.positionCode", searchParameter.getParentCode()));
    }
    if (searchParameter.getPositionCode() != null) {
        criteria.add(Restrictions.eq("positionCode", searchParameter.getPositionCode()));
    }

    if (searchParameter.getGradeName() != null) {
        criteria.createAlias("grade", "gd", JoinType.INNER_JOIN);
        criteria.add(Restrictions.eq("gd.gradeName", searchParameter.getGradeName()));
    }
    if (searchParameter.getGolonganJabatanName() != null) {
        criteria.createAlias("golonganJabatan", "gj", JoinType.INNER_JOIN);
        criteria.add(Restrictions.eq("gj.golonganJabatanCode", searchParameter.getGolonganJabatanName()));
    }
}

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

private void doSearchRecruitLettersByParam(RecrutimentLetterSearchParameter parameter, Criteria criteria) {
    if (StringUtils.isNotEmpty(parameter.getSelectionType())) {
        criteria.createAlias("recruitLetterSelections", "rs", JoinType.INNER_JOIN);
        criteria.createAlias("rs.recruitSelectionType", "se", JoinType.INNER_JOIN);
        criteria.add(Restrictions.like("se.name", parameter.getSelectionType(), MatchMode.ANYWHERE));

    }/*from  www.  ja va2s. c  om*/
    if (StringUtils.isNotEmpty(parameter.getLetterType())) {
        criteria.add(Restrictions.eq("leterTypeId", Integer.parseInt(parameter.getLetterType())));
    }
    if (StringUtils.isNotEmpty(parameter.getSenderBy())) {
        criteria.createAlias("recruitLetterComChannels", "rc", JoinType.INNER_JOIN);
        criteria.createAlias("rc.recruitCommChannels", "rcom", JoinType.INNER_JOIN);
        criteria.add(Restrictions.like("rcom.channelName", parameter.getSenderBy(), MatchMode.ANYWHERE));
    }
    criteria.add(Restrictions.isNotNull("id"));
}

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

@Override
public RecruitmenSelectionSeriesDetail getByListOrderAndRecSelectionSeriesId(Integer number, Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("recruitmenSelectionSeries", "recruitmenSelectionSeries", JoinType.INNER_JOIN);
    criteria.add(Restrictions.eq("listOrder", number));
    criteria.add(Restrictions.eq("recruitmenSelectionSeries.id", id));
    return (RecruitmenSelectionSeriesDetail) criteria.uniqueResult();
}

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

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

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

@Override
public RecruitmenSelectionSeriesDetail getEntityByRecruitSelectionTypeAndRecruitmenSelectionSeries(
        Long recruitSelectionType, Long recruitSelectionSeries) {

    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("recruitSelectionType", "recruitSelectionType", JoinType.INNER_JOIN);
    criteria.createAlias("recruitmenSelectionSeries", "recruitmenSelectionSeries", JoinType.INNER_JOIN);
    criteria.add(Restrictions.eq("recruitSelectionType.id", recruitSelectionType));
    criteria.add(Restrictions.eq("recruitmenSelectionSeries.id", recruitSelectionSeries));
    return (RecruitmenSelectionSeriesDetail) criteria.uniqueResult();
}

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

@Override
public List<RecruitmenSelectionSeriesDetail> getAllByRecruitRecruitSelectionTypeId(long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("recruitSelectionType", "rs", JoinType.INNER_JOIN);
    criteria.add(Restrictions.eq("rs.id", id));
    return criteria.list();
}

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

@Override
public Long getTotalApplicantByRecruitHireApplyId(Long recruitHireApplyId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("recruitHireApply", "recruitHireApply", JoinType.INNER_JOIN);
    criteria.add(Restrictions.eq("recruitHireApply.id", recruitHireApplyId));
    Long result = criteria.setProjection(Projections.rowCount()).uniqueResult() == null ? 0l
            : (Long) criteria.setProjection(Projections.rowCount()).uniqueResult();
    return result;
}

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

@Override
public List<RecruitSelectionApplicantInitial> getListByRecruitHireApplyId(Long recruitHireApplyId) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("recruitHireApply", "recruitHireApply", JoinType.INNER_JOIN);
    criteria.createAlias("recruitApplicant", "recruitApplicant", JoinType.INNER_JOIN);
    criteria.createAlias("recruitApplicant.bioData", "bioData", JoinType.INNER_JOIN);
    criteria.add(Restrictions.eq("recruitHireApply.id", recruitHireApplyId));
    return criteria.list();
}

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

@Override
public List<RecruitSelectionTypeTemplates> getByParentId(long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("recruitSelectionTypeTemplates", "dp", JoinType.INNER_JOIN);
    criteria.add(Restrictions.eq("dp.id", id));
    criteria.setFetchMode("recruitSelectionTypeTemplateses", FetchMode.JOIN);
    criteria.setFetchMode("recruitSelectionTypeTemplateses.recruitSelectionTypeTemplates", FetchMode.JOIN);
    criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    return criteria.list();
}