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:io.hops.hopsworks.common.dao.jupyter.JupyterSettingsFacade.java

public List<JupyterSettings> findJupyterSettingsByProject(Integer projectId) {
    TypedQuery<JupyterSettings> query = em.createNamedQuery("JupyterSettings.findByProjectId",
            JupyterSettings.class);
    query.setParameter("projectId", projectId);
    return query.getResultList();
}

From source file:io.hops.hopsworks.common.dao.rstudio.RStudioSettingsFacade.java

public List<RStudioSettings> findJupyterSettingsByProject(Integer projectId) {
    TypedQuery<RStudioSettings> query = em.createNamedQuery("JupyterSettings.findByProjectId",
            RStudioSettings.class);
    query.setParameter("projectId", projectId);
    return query.getResultList();
}

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

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

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

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

From source file:org.openmeetings.app.data.flvrecord.FlvRecordingLogDaoImpl.java

public List<FlvRecordingLog> getFLVRecordingLogByRecordingId(Long flvRecordingId) {
    try {/*  w  ww. ja  v a2  s  .  com*/
        String hql = "select c from FlvRecordingLog as c where c.flvRecording.flvRecordingId = :flvRecordingId";

        TypedQuery<FlvRecordingLog> query = em.createQuery(hql, FlvRecordingLog.class);
        query.setParameter("flvRecordingId", flvRecordingId);
        List<FlvRecordingLog> flvRecordingList = query.getResultList();

        return flvRecordingList;

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

From source file:org.openmeetings.app.data.basic.dao.OmTimeZoneDaoImpl.java

public OmTimeZone getOmTimeZoneById(Long omtimezoneId) {
    try {//from w  w w  .  j a  va 2  s .c  o m
        String hql = "select sl from OmTimeZone as sl " + "WHERE sl.omtimezoneId = :omtimezoneId";
        TypedQuery<OmTimeZone> query = em.createQuery(hql, OmTimeZone.class);
        query.setParameter("omtimezoneId", omtimezoneId);
        List<OmTimeZone> sList = query.getResultList();

        if (sList.size() > 0) {
            return sList.get(0);
        }

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

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

@Override
@Transactional(value = "defaultTransactionManager")
public Collection<ApprovedSite> getByUserId(String userId) {
    TypedQuery<ApprovedSite> query = manager.createNamedQuery(ApprovedSite.QUERY_BY_USER_ID,
            ApprovedSite.class);
    query.setParameter(ApprovedSite.PARAM_USER_ID, userId);

    return query.getResultList();

}

From source file:org.openmeetings.app.data.user.dao.PrivateMessageFolderDaoImpl.java

public List<PrivateMessageFolder> getPrivateMessageFolders() {
    try {//from w w  w .j  ava  2s  .c o  m
        String hql = "select c from PrivateMessageFolder c ";

        TypedQuery<PrivateMessageFolder> query = em.createQuery(hql, PrivateMessageFolder.class);

        List<PrivateMessageFolder> privateMessageFolders = query.getResultList();

        return privateMessageFolders;
    } catch (Exception e) {
        log.error("[getPrivateMessageFolderById]", e);
    }
    return null;
}

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

public List<RoomPoll> getPollListBackup() {
    try {//from www. jav  a  2s  . c o m
        TypedQuery<RoomPoll> q = em.createQuery("SELECT rp FROM RoomPoll rp", RoomPoll.class);
        return q.getResultList();
    } catch (NoResultException nre) {
        //expected
    } catch (Exception err) {
        log.error("[getPoll]", err);
    }
    return null;
}

From source file:io.hops.hopsworks.common.dao.user.security.audit.AccountAuditFacade.java

public List<AccountAudit> findByTarget(Users user) {
    TypedQuery<AccountAudit> query = em.createNamedQuery("AccountAudit.findByTarget", AccountAudit.class);
    query.setParameter("target", user);

    return query.getResultList();
}

From source file:com.nuevebit.persistence.repository.JPASearchableRepository.java

@Override
public final List<T> search(S searchCriteria, Pageable pageable) {
    CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
    CriteriaQuery<T> query = cb.createQuery(getEntityClass());

    Root<T> p = createQueryRoot(query, searchCriteria);
    query.select(p);//from  w w w . ja v a 2  s . com

    Order sortOrder = getSortOrder(cb);
    if (sortOrder != null) {
        query.orderBy(sortOrder);
    }

    TypedQuery<T> typedQuery = getEntityManager().createQuery(query);
    if (pageable != null) {
        typedQuery.setFirstResult(pageable.getOffset()).setMaxResults(pageable.getPageSize());
    }

    return typedQuery.getResultList();
}