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.core.dao.StudyDao.java

License:Open Source License

public List<ConsentAnswer> getConsentAnswer() {
    Criteria criteria = getSession().createCriteria(ConsentAnswer.class);
    return criteria.list();
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

public List<YesNo> getYesNoList() {
    Criteria criteria = getSession().createCriteria(YesNo.class);
    return criteria.list();
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

public List<PersonContactMethod> getPersonContactMethodList() {
    Criteria criteria = getSession().createCriteria(PersonContactMethod.class);
    return criteria.list();
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

public PersonLastnameHistory getPreviousSurnameHistory(PersonLastnameHistory personSurnameHistory) {
    PersonLastnameHistory personLastnameHistoryToReturn = null;

    Example example = Example.create(personSurnameHistory);

    Criteria criteria = getSession().createCriteria(PersonLastnameHistory.class).add(example);
    if (criteria != null) {// should it ever?
        List<PersonLastnameHistory> results = criteria.list();
        if (results != null && !results.isEmpty()) {
            personLastnameHistoryToReturn = (PersonLastnameHistory) results.get(0);
        }//  ww w .jav a2 s  . co  m
    }
    return personLastnameHistoryToReturn;
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

public String getPreviousLastname(Person person) {
    Criteria criteria = getSession().createCriteria(PersonLastnameHistory.class);

    if (person.getId() != null) {
        criteria.add(Restrictions.eq(Constants.PERSON_SURNAME_HISTORY_PERSON, person));
    }//from ww  w. j av a 2  s  .c o  m
    criteria.addOrder(Order.asc("id"));
    PersonLastnameHistory personLastameHistory = new PersonLastnameHistory();

    List<PersonLastnameHistory> results = criteria.list();
    if (results.size() > 0) {

        // what this is saying is get the second-last last-name to display
        // as "previous lastname"
        personLastameHistory = (PersonLastnameHistory) results.get(results.size() - 1);
    } // else it doesnt have a previous...only a current

    return personLastameHistory.getLastName();
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

public List<PersonLastnameHistory> getLastnameHistory(Person person) {
    Criteria criteria = getSession().createCriteria(PersonLastnameHistory.class);

    if (person.getId() != null) {
        criteria.add(Restrictions.eq(Constants.PERSON_SURNAME_HISTORY_PERSON, person));
    }/*from  w w  w  .  j a va 2 s .  c  o m*/

    return criteria.list();
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

public List<SubjectUidPadChar> getListOfSubjectUidPadChar() {
    Example subjectUidPadChar = Example.create(new SubjectUidPadChar());
    Criteria studyStatusCriteria = getSession().createCriteria(SubjectUidPadChar.class).add(subjectUidPadChar);
    return studyStatusCriteria.list();
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

public List<SubjectUidToken> getListOfSubjectUidToken() {
    Example subjectUidToken = Example.create(new SubjectUidToken());
    Criteria studyStatusCriteria = getSession().createCriteria(SubjectUidToken.class).add(subjectUidToken);
    return studyStatusCriteria.list();
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

public GenderType getGenderType(String name) {
    Criteria criteria = getSession().createCriteria(GenderType.class);
    criteria.add(Restrictions.eq("name", name));
    GenderType genderType = new GenderType();
    List<GenderType> results = criteria.list();
    if (!results.isEmpty()) {
        genderType = (GenderType) results.get(0);
    }// w  ww  .j  a  va2s  .c o m
    return genderType;
}

From source file:au.org.theark.core.dao.StudyDao.java

License:Open Source License

public VitalStatus getVitalStatus(String name) {
    Criteria criteria = getSession().createCriteria(VitalStatus.class);
    criteria.add(Restrictions.eq("name", name));
    VitalStatus vitalStatus = new VitalStatus();
    List<VitalStatus> results = criteria.list();

    if (!results.isEmpty()) {
        vitalStatus = (VitalStatus) results.get(0);
    }/*from   w  ww . j ava 2 s . c  om*/
    return vitalStatus;
}