Example usage for javax.persistence TypedQuery getResultList

List of usage examples for javax.persistence TypedQuery getResultList

Introduction

In this page you can find the example usage for javax.persistence TypedQuery getResultList.

Prototype

List<X> getResultList();

Source Link

Document

Execute a SELECT query and return the query results as a typed List.

Usage

From source file:org.openmeetings.app.data.conference.PollManagement.java

public List<PollType> getPollTypes() {
    TypedQuery<PollType> q = em.createQuery("SELECT pt FROM PollType pt", PollType.class);
    return q.getResultList();
}

From source file:org.jasig.portlet.blackboardvcportlet.dao.impl.SessionRecordingDaoImpl.java

@Override
public Set<SessionRecording> getAllRecordings() {
    final TypedQuery<SessionRecordingImpl> query = this.createCachedQuery(this.findAllSessionRecordings);

    final List<SessionRecordingImpl> sessionRecordings = query.getResultList();
    return new LinkedHashSet<SessionRecording>(sessionRecordings);
}

From source file:org.jasig.portlet.blackboardvcportlet.dao.impl.SessionTelephonyDaoImpl.java

@Override
public Set<SessionTelephony> getAllTelephony() {
    final TypedQuery<SessionTelephonyImpl> query = this.createCachedQuery(this.findAllSessionTelephony);

    final List<SessionTelephonyImpl> sessionTelephonyList = query.getResultList();
    return new LinkedHashSet<SessionTelephony>(sessionTelephonyList);
}

From source file:org.jboss.quickstarts.wfk.contact.ContactRepository.java

/**
 * Find all the Contacts and sort them alphabetically by last name.
 * /*from   ww w .j  av a2 s  .  c o  m*/
 * @return List of Contacts
 */
List<Contact> findAllOrderedByName() {
    TypedQuery<Contact> query = em.createNamedQuery(Contact.FIND_ALL, Contact.class);
    List<Contact> contacts = query.getResultList();
    return contacts;
}

From source file:org.openmeetings.app.data.basic.FieldLanguageDaoImpl.java

public List<FieldLanguage> getLanguages() {
    try {//from  ww  w.  j  a v a 2  s .  c  o  m
        String hql = "select c from FieldLanguage as c " + "WHERE c.deleted <> :deleted ";
        TypedQuery<FieldLanguage> query = em.createQuery(hql, FieldLanguage.class);
        query.setParameter("deleted", "true");
        List<FieldLanguage> ll = query.getResultList();
        return ll;
    } catch (Exception ex2) {
        log.error("[getLanguages]: ", ex2);
    }
    return null;
}

From source file:com.ewcms.content.particular.dao.FrontProjectArticleDAO.java

public List<ProjectArticle> findProjectArticleByCode(String code) {
    String hql = "From ProjectArticle As p where p.projectBasic.code=:code and p.release=true Order By p.published desc ";
    TypedQuery<ProjectArticle> query = this.getEntityManager().createQuery(hql, ProjectArticle.class);
    query.setParameter("code", code);
    return query.getResultList();
}

From source file:org.mitre.openid.connect.repository.impl.JpaUserInfoRepository.java

/**
 * Get a single UserInfo object by its username
 */// www.  ja  v a2 s. c o  m
@Override
public UserInfo getByUsername(String username) {
    TypedQuery<DefaultUserInfo> query = manager.createNamedQuery(DefaultUserInfo.QUERY_BY_USERNAME,
            DefaultUserInfo.class);
    query.setParameter(DefaultUserInfo.PARAM_USERNAME, username);

    return getSingleResult(query.getResultList());

}

From source file:org.openmeetings.app.data.basic.ErrorManagement.java

public List<ErrorType> getErrorTypes() {
    try {// w  w  w .j  av a  2 s. c  o m
        String hql = "select c from ErrorType as c " + "WHERE c.deleted <> :deleted ";
        TypedQuery<ErrorType> query = em.createQuery(hql, ErrorType.class);
        query.setParameter("deleted", "true");
        List<ErrorType> ll = query.getResultList();
        return ll;
    } catch (Exception ex2) {
        log.error("[getErrorTypes]: ", ex2);
    }
    return null;
}

From source file:com.ewcms.content.particular.dao.FrontEnterpriseArticleDAO.java

public List<EnterpriseArticle> findEnterpriseArticleBySector(Long organId) {
    String hql = "From EnterpriseArticle As p where p.organ.id=:organId and p.release=true Order By p.published desc ";
    TypedQuery<EnterpriseArticle> query = this.getEntityManager().createQuery(hql, EnterpriseArticle.class);
    query.setParameter("organId", Integer.valueOf(organId.toString()));
    return query.getResultList();
}

From source file:com.sshdemo.common.report.manage.dao.CategoryReportDAO.java

public Boolean findTextIsEntityByTextAndCategory(final Long textReportId, final Long categoryReportId) {
    String hql = "Select c From CategoryReport As c Left Join c.texts As t Where t.id=:textReportId And c.id=:categoryReportId";

    TypedQuery<CategoryReport> query = this.getEntityManager().createQuery(hql, CategoryReport.class);
    query.setParameter("textReportId", textReportId);
    query.setParameter("categoryReportId", categoryReportId);

    List<CategoryReport> list = query.getResultList();
    return list.isEmpty() ? false : true;
}