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:com.sshdemo.common.report.manage.dao.ChartReportDAO.java

public List<CategoryReport> findCategoryReportByChartReportId(final Long chartReportId) {
    String hql = "Select c From CategoryReport As c Left Join c.charts As t Where t.id=:chartReportId";

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

    return query.getResultList();
}

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

public List<EwcmsJobReport> findEwcmsJobReportByChartReportId(final Long chartReportId) {
    String hql = "Select e From EwcmsJobReport As e Where e.chartReport.id=:chartReportId";

    TypedQuery<EwcmsJobReport> query = this.getEntityManager().createQuery(hql, EwcmsJobReport.class);
    query.setParameter("chartReportId", chartReportId);

    return query.getResultList();
}

From source file:br.eti.danielcamargo.backend.hsnpts.core.business.ProgramaService.java

public List<Programa> findByAlunoId(Long alunoId) throws BusinessException {
    StringBuilder hql = new StringBuilder();

    hql.append("SELECT ");
    hql.append(" p ");
    hql.append("FROM ");
    hql.append("  Programa p ");
    hql.append("  JOIN p.aluno a ");
    hql.append("WHERE ");
    hql.append("  a.id = :alunoId ");
    hql.append("ORDER BY ");
    hql.append("  p.dataInicio DESC");

    TypedQuery<Programa> query = em.createQuery(hql.toString(), Programa.class);
    query.setParameter("alunoId", alunoId);

    List<Programa> result = query.getResultList();

    return result;
}

From source file:com.deltastar.task7.core.repository.api.impl.TransitionViewRepositoryImpl.java

@Override
public List<TransitionView> getTransitionList() {
    TypedQuery<TransitionView> query = entityManager.createNamedQuery("findAllTransitionView",
            TransitionView.class);
    return query.getResultList();

}

From source file:org.jasig.portlet.attachment.dao.jpa.JpaAttachmentDao.java

private List<Attachment> getResultList(String select, Map<String, String> params) {
    try {/*from   w  w  w.  ja  v a  2  s  .  c  o m*/
        final TypedQuery<Attachment> query = createQuery(select, params);
        List<Attachment> results = query.getResultList();
        return results;
    } catch (NoResultException noResultException) {
        return null;
    }
}

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

@Override
@Transactional(value = "defaultTransactionManager")
public Collection<ApprovedSite> getAll() {
    TypedQuery<ApprovedSite> query = manager.createNamedQuery(ApprovedSite.QUERY_ALL, ApprovedSite.class);
    return query.getResultList();
}

From source file:com.googlecode.osgienterprise.geminitx.library.service.PersistentLibraryService.java

public List<Book> findBooksByAuthor(String lastName) {
    String jpql = "select b from Book b where b.author.lastName = :lastName";
    TypedQuery<Book> query = em.createQuery(jpql, Book.class);
    query.setParameter("lastName", lastName);
    List<Book> books = query.getResultList();
    return books;
}

From source file:puma.application.webapp.documents.DocumentDAOImpl.java

@Override
public List<Document> getDocumentsByOrigin(String origin) {
    TypedQuery<Document> query = em.createNamedQuery("documentsByOrigin", Document.class);
    query.setParameter("origin", origin);
    List<Document> results = query.getResultList();
    return results;
}

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

public List<EmployeArticle> findEmployeArticleLimit(Integer number) {
    String hql = "From EmployeArticle As p where p.release=true Order By p.published desc limit " + number;
    TypedQuery<EmployeArticle> query = this.getEntityManager().createQuery(hql, EmployeArticle.class);
    return query.getResultList();
}

From source file:com.movies.dao.impl.BaseDaoImpl.java

@Override
public <T> List<T> getAllObjects(Class clazz) {
    CriteriaBuilder cb = em.getCriteriaBuilder();
    CriteriaQuery<T> cq = cb.createQuery(clazz);
    Root<T> object = cq.from(clazz);
    cq.select(object);//from  w w  w  . j a  v a2  s .c om
    TypedQuery<T> q = em.createQuery(cq);
    return q.getResultList();
}