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.user.Salutationmanagement.java

/**
 * get a list of all availible Salutations
 * //from  w  ww .  j  a  v  a2s  . c  o m
 * @param user_level
 * @return
 */
public List<Salutations> getUserSalutations(long language_id) {
    try {
        CriteriaBuilder cb = em.getCriteriaBuilder();
        CriteriaQuery<Salutations> cq = cb.createQuery(Salutations.class);
        Root<Salutations> from = cq.from(Salutations.class);
        CriteriaQuery<Salutations> select = cq.select(from);
        TypedQuery<Salutations> q = em.createQuery(select);
        List<Salutations> ll = q.getResultList();
        for (Salutations ti : ll) {
            ti.setLabel(fieldmanagment.getFieldByIdAndLanguage(ti.getFieldvalues_id(), language_id));
        }

        return ll;
    } catch (Exception ex2) {
        log.error("[addUserSalutation]", ex2);
    }
    return null;
}

From source file:com.beto.test.securityinterceptor.model.dao.generic.AbstractDao.java

public List<T> selectNativeQueryToList(String Q) throws Exception {
    TypedQuery<T> tq = getEntityManager().createQuery(Q, entityClass);
    return tq.getResultList();
}

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

@Override
public List<Fund> findAllFund() {
    TypedQuery<Fund> query = entityManager.createNamedQuery("findAllFund", Fund.class);
    return query.getResultList();
}

From source file:com.github.springtestdbunit.entity.OtherEntityAssert.java

public void assertValues(String... values) {
    SortedSet<String> expected = new TreeSet<String>(Arrays.asList(values));
    SortedSet<String> actual = new TreeSet<String>();
    TypedQuery<OtherSampleEntity> query = this.entityManager.createQuery(this.criteriaQuery);
    List<OtherSampleEntity> results = query.getResultList();
    for (OtherSampleEntity sampleEntity : results) {
        actual.add(sampleEntity.getValue());
        this.entityManager.detach(sampleEntity);
    }/*from   w w w. j  a v a 2 s.co  m*/
    assertEquals(expected, actual);
}

From source file:com.smhdemo.common.report.dao.TextDao.java

public List<Category> findCategoryReportByTextReportId(final Long textReportId) {
    String hql = "Select c From Category As c Left Join c.textReports As t Where t.id=:textReportId";

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

    return query.getResultList();
}

From source file:com.smhdemo.common.report.dao.ChartDao.java

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

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

    return query.getResultList();
}

From source file:org.mitre.uma.repository.impl.JpaResourceSetRepository.java

@Override
public Collection<ResourceSet> getAll() {
    TypedQuery<ResourceSet> query = em.createNamedQuery(ResourceSet.QUERY_ALL, ResourceSet.class);
    return query.getResultList();
}

From source file:com.plan.proyecto.repositorios.DaoCuentaImpl.java

@Override
public List<Cuenta> findAll() {
    TypedQuery<Cuenta> query = em.createNamedQuery("Cuenta.findAll", Cuenta.class);
    return query.getResultList();
}

From source file:org.ualerts.fixed.repository.JpaFixtureRepository.java

/**
 * {@inheritDoc}//from w  w w. jav  a  2s .co  m
 */
@Override
public List<Fixture> findAllFixtures() {
    TypedQuery<Fixture> query = getEntityManager().createNamedQuery("findAllFixtureDetails", Fixture.class);
    return query.getResultList();
}

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

@Override
public List<Customer> findAllCustomer() {
    TypedQuery<Customer> query = entityManager.createNamedQuery("findAllCustomer", Customer.class);
    return query.getResultList();
}