Example usage for org.hibernate Criteria list

List of usage examples for org.hibernate Criteria list

Introduction

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

Prototype

public List list() throws HibernateException;

Source Link

Document

Get the results.

Usage

From source file:au.org.theark.study.model.dao.StudyDao.java

License:Open Source License

public List<StudyComp> searchStudyComp(StudyComp studyCompCriteria) {
    Criteria criteria = getSession().createCriteria(StudyComp.class);
    if (studyCompCriteria.getId() != null) {
        //criteria.add(Restrictions.like(Constants.ID, studyCompCriteria.getId().toString(),MatchMode.ANYWHERE));
        //ARK-1558
        criteria.add(Restrictions.sqlRestriction(" id LIKE '%" + studyCompCriteria.getId() + "%' "));
    }/*from   ww  w  .j av a2  s  . co m*/
    if (studyCompCriteria.getName() != null) {
        criteria.add(
                Restrictions.ilike(Constants.STUDY_COMP_NAME, studyCompCriteria.getName(), MatchMode.ANYWHERE));
    }
    if (studyCompCriteria.getKeyword() != null) {
        criteria.add(Restrictions.ilike(Constants.STUDY_COMP_KEYWORD, studyCompCriteria.getKeyword(),
                MatchMode.ANYWHERE));
    }
    // Restrict the search for the study do not pull other study components
    criteria.add(Restrictions.eq("study", studyCompCriteria.getStudy()));

    List<StudyComp> list = criteria.list();
    return list;
}

From source file:au.org.theark.study.model.dao.StudyDao.java

License:Open Source License

public List<PhoneType> getListOfPhoneType() {
    Example phoneTypeExample = Example.create(new PhoneType());
    Criteria criteria = getSession().createCriteria(PhoneType.class).add(phoneTypeExample);
    return criteria.list();
}

From source file:au.org.theark.study.model.dao.StudyDao.java

License:Open Source License

public Collection<TitleType> getTitleType() {
    Example example = Example.create(new TitleType());
    Criteria criteria = getSession().createCriteria(TitleType.class).add(example);
    return criteria.list();
}

From source file:au.org.theark.study.model.dao.StudyDao.java

License:Open Source License

public Collection<VitalStatus> getVitalStatus() {
    Example example = Example.create(new VitalStatus());
    Criteria criteria = getSession().createCriteria(VitalStatus.class).add(example);
    return criteria.list();
}

From source file:au.org.theark.study.model.dao.StudyDao.java

License:Open Source License

public Collection<GenderType> getGenderTypes() {
    Example example = Example.create(new GenderType());
    Criteria criteria = getSession().createCriteria(GenderType.class).add(example);
    return criteria.list();
}

From source file:au.org.theark.study.model.dao.StudyDao.java

License:Open Source License

public ConsentType getConsentTypeByName(String name) {
    ConsentType consentType = null;//  w ww  .  j a va  2 s  .  c o m
    Criteria criteria = getSession().createCriteria(ConsentType.class);
    criteria.add(Restrictions.eq("name", name));

    if (criteria.list().size() > 0) {
        consentType = (ConsentType) criteria.list().get(0);
    }
    return consentType;
}

From source file:au.org.theark.study.model.dao.StudyDao.java

License:Open Source License

public ConsentStatus getConsentStatusByName(String name) {
    ConsentStatus consentStatus = null;// w  w w .ja  va2s.  c o  m
    Criteria criteria = getSession().createCriteria(ConsentStatus.class);
    criteria.add(Restrictions.eq("name", name));

    if (criteria.list().size() > 0) {
        consentStatus = (ConsentStatus) criteria.list().get(0);
    }
    return consentStatus;
}

From source file:au.org.theark.study.model.dao.StudyDao.java

License:Open Source License

private VitalStatus getVitalStatus(Long id) {
    Criteria criteria = getSession().createCriteria(VitalStatus.class);

    if (id != null) {
        criteria.add(Restrictions.eq("id", id));
    }//from  ww w .  j ava2 s  .  co m

    return (VitalStatus) criteria.list().get(0);
}

From source file:au.org.theark.study.model.dao.StudyDao.java

License:Open Source License

public MaritalStatus getMaritalStatusNyName(String name) {
    Criteria criteria = getSession().createCriteria(MaritalStatus.class);

    if (name != null) {
        criteria.add(Restrictions.eq("name", name));
    }//  w  ww . j  ava2 s.c om

    return (MaritalStatus) criteria.list().get(0);
}

From source file:au.org.theark.study.model.dao.StudyDao.java

License:Open Source License

public GenderType getGenderType(Long id) {
    Criteria criteria = getSession().createCriteria(GenderType.class);

    if (id != null) {
        criteria.add(Restrictions.eq("id", id));
    }/*from w w w. ja va  2 s . c o m*/

    return (GenderType) criteria.list().get(0);
}