Example usage for javax.persistence Query getResultList

List of usage examples for javax.persistence Query getResultList

Introduction

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

Prototype

List getResultList();

Source Link

Document

Execute a SELECT query and return the query results as an untyped List.

Usage

From source file:Student.java

  public void search() {
  Query q = em.createQuery("select m from Student m");
  for (Student m : (List<Student>) q.getResultList()) {
    System.out.println(m);/*  w  w w.ja v a  2 s  . co  m*/
  }
}

From source file:com.webbfontaine.valuewebb.bpm.DocumentHistory.java

public void loadHises() {
    if (id == null) {
        return;/*from   w  w w  .j a  va2  s . c o  m*/
    }
    Query query = getEntityManager().createNativeQuery(getNativeQuery());
    query.setParameter("id", id);
    history = (List<Object[]>) query.getResultList();

    loadUserDetails();
}

From source file:dao.ExperienceDAOImpl.java

@Override
public List<ExperienceEntity> findExperiencesForProfil(Long profileId) {
    Query q;
    q = this.em.createQuery("SELECT e FROM ExperienceEntity e WHERE e.profile.id = ?");
    q.setParameter(1, profileId);/*w ww  .  j a  v  a 2  s  .com*/
    return q.getResultList();
}

From source file:org.syncope.core.persistence.dao.impl.PolicyDAOImpl.java

@Override
public List<? extends Policy> find(final PolicyType type) {
    final Query query = entityManager.createQuery("SELECT e FROM Policy e WHERE e.type=:type");
    query.setParameter("type", type);

    return query.getResultList();
}

From source file:com.gerenciaProyecto.DaoImple.ProductoDaoImpl.java

@Override
public Producto ObtenerProductoId(Integer p_IdProducto) {
    EntityManager em = getEntityManager();
    List<Producto> lista = new ArrayList<Producto>();
    Query q = em.createQuery("SELECT p FROM Producto p WHERE p.id = :id");
    q.setParameter("id", p_IdProducto);
    lista = q.getResultList();
    for (Producto lista1 : lista) {
        if (lista1.getId() == p_IdProducto) {
            return lista1;
        }/*from  w  w  w  .j ava2 s .  c  o  m*/
    }
    return null;
}

From source file:org.kuali.mobility.push.dao.PushDeviceTupleDaoImpl.java

@SuppressWarnings("unchecked")
public List<PushDeviceTuple> findUnsentTuples() {
    Query query = entityManager.createNamedQuery("PushDeviceTuple.findUnsent");
    return query.getResultList();
}

From source file:com.sun.socialsite.business.impl.JPAThemeSettingsManagerImpl.java

/**
 * Note: using SuppressWarnings annotation because the JPA API is not genericized.
 *///  w  w w.jav a 2 s .com
@SuppressWarnings(value = "unchecked")
public List<ThemeSettings> getThemeSettings() throws SocialSiteException {
    Query query = strategy.getNamedQuery("ThemeSettings.getAll");
    return (List<ThemeSettings>) query.getResultList();
}

From source file:at.irian.demo.jsfatwork.repository.jpa.JpaGroupRepository.java

public List<Group> loadAllFor(User user) {
    Query query = this.entityManager.createNamedQuery(DomainQueryDetails.FIND_SUBSCRIBED_GROUPS);
    query.setParameter(DomainQueryDetails.PARAMETER_USER, user);
    return query.getResultList();
}

From source file:ca.travelagency.persistence.DaoSupportImpl.java

@SuppressWarnings("unchecked")
@Override//from w w w . j  a  v  a 2 s  .c o  m
public List<String> groupBy(DaoCriteria daoCriteria) {
    Query query = QuerySQL.groupBy(daoCriteria.getCriteria(), entityManager).makeQuery();
    return (List<String>) query.getResultList();
}

From source file:com.mycompany.login.mb.LoginBean.java

public List carregaBombas() {
    FacesContext context = FacesContext.getCurrentInstance();
    HttpSession session = (HttpSession) context.getExternalContext().getSession(false);
    Usuario usuario = (Usuario) session.getAttribute("usuarioLogado");
    Query query = em.createQuery("SELECT numserie FROM Bombas u WHERE u.nomecliente = :nomecliente");
    query.setParameter("nomecliente", usuario.getVinculo());
    bombasusuario = query.getResultList();
    return bombasusuario;
}