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

@Override
public List<LoanNewType> getByParam(LoanNewTypeSearchParameter parameter, int firstResult, int maxResults,
        Order orderable) {//from   ww w  . j  ava2s  . com
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("currency", "currency", JoinType.INNER_JOIN);
    doSearchLoanTypeByParam(parameter, criteria);
    criteria.addOrder(orderable);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<LoanType> getByParam(LoanTypeSearchParameter parameter, int firstResult, int maxResults,
        Order orderable) {/*from  w  w w .  j  a va2s  . c o  m*/
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchLoanTypeByParam(parameter, criteria);
    criteria.createAlias("currency", "currency", JoinType.INNER_JOIN);
    criteria.addOrder(orderable);
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<LoginHistory> getByParam(int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("hrmUser", "hrmUser", JoinType.LEFT_OUTER_JOIN);
    criteria.addOrder(order);/*from w ww.j a v  a  2s  . c om*/
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<LoginHistory> getByParam(LoginHistorySearchParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchLoginHistByParam(searchParameter, criteria);
    criteria.createAlias("hrmUser", "hrmUser", JoinType.LEFT_OUTER_JOIN);
    criteria.addOrder(order);//from w ww  .  j  a va 2 s.  co  m
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public Long getTotalLoginHistoryByParam(LoginHistorySearchParameter searchParameter) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.createAlias("hrmUser", "hrmUser", JoinType.LEFT_OUTER_JOIN);
    doSearchLoginHistByParam(searchParameter, criteria);
    return (Long) criteria.setProjection(Projections.rowCount()).uniqueResult();
}

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

private void doSearchByParam(OhsaIncidentSearchParameter parameter, Criteria criteria) {

    criteria.createAlias("ohsaCategory", "ohsaCategory", JoinType.INNER_JOIN);
    if (StringUtils.isNotEmpty(parameter.getKategori())) {
        criteria.add(Restrictions.like("ohsaCategory.name", parameter.getKategori(), MatchMode.ANYWHERE));
    }//from  w  w  w .  ja  v  a  2s . com
    if (StringUtils.isNotEmpty(parameter.getSubjek())) {
        criteria.add(Restrictions.like("subject", parameter.getSubjek(), MatchMode.ANYWHERE));
    }
    if (StringUtils.isNotEmpty(parameter.getLokasi())) {
        criteria.add(Restrictions.like("location", parameter.getLokasi(), MatchMode.ANYWHERE));
    }
    criteria.add(Restrictions.isNotNull("id"));
}

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

@Override
public List<OrgTypeOfSpecJabatan> getAllDataByJabatanId(Long id, int firstResult, int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("jabatan.id", id));
    criteria.setFetchMode("jabatan", FetchMode.JOIN);
    criteria.setFetchMode("orgTypeOfSpecList", FetchMode.JOIN);

    criteria.createAlias("jabatan", "jabatan", JoinType.INNER_JOIN);
    criteria.createAlias("orgTypeOfSpecList", "orgTypeOfSpecList", JoinType.INNER_JOIN);

    criteria.addOrder(order);// ww w. j a va  2  s  .  co m
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    return criteria.list();
}

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

@Override
public List<OrgTypeOfSpecJabatan> getAllDataByJabatanId(Long id) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    criteria.add(Restrictions.eq("jabatan.id", id));
    criteria.setFetchMode("jabatan", FetchMode.JOIN);
    criteria.setFetchMode("orgTypeOfSpecList", FetchMode.JOIN);

    criteria.createAlias("jabatan", "jabatan", JoinType.INNER_JOIN);
    criteria.createAlias("orgTypeOfSpecList", "orgTypeOfSpecList", JoinType.INNER_JOIN);

    return criteria.list();
}

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

@Override
public List<OrgTypeOfSpecList> getByParam(OrgTypeOfSpecListSearchParameter searchParameter, int firstResult,
        int maxResults, Order order) {
    Criteria criteria = getCurrentSession().createCriteria(getEntityClass());
    doSearchByParam(searchParameter, criteria);
    criteria.addOrder(order);//  w  w w .  j  a v a2  s .c o  m
    criteria.setFirstResult(firstResult);
    criteria.setMaxResults(maxResults);
    criteria.setFetchMode("orgTypeOfSpec", FetchMode.JOIN);
    criteria.createAlias("orgTypeOfSpec", "orgTypeOfSpec", JoinType.INNER_JOIN);
    return criteria.list();
}