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:com.srinathavan.mwbng.core.repositories.jpa.JpaAccountRepo.java

@Override
public List<Account> findAllAccounts() {
    Query query = em.createQuery("select a from Account a");
    return query.getResultList();
}

From source file:DAO.IMCDAOImpl.java

@Transactional
@Override// ww  w . j  a  va 2 s  .co m
public List<IMCEntity> findAll() {
    Query q = em.createQuery("SELECT i FROM IMCEntity i");
    return q.getResultList();
}

From source file:modelo.GestionImpl.java

@Override
public List<HandPlantas> listarCentros() {
    Query q = em.createNamedQuery("HandPlantas.findAll");
    List<HandPlantas> listaplant;
    listaplant = q.getResultList();
    return listaplant;
}

From source file:ch.javaee.basicMvc.repository.UserRepositoryImpl.java

@Override
public Collection loadUsers() {
    Query query = em.createQuery("from user");
    return query.getResultList();
}

From source file:es.ucm.fdi.dalgs.mailbox.respository.MailBoxRepository.java

@SuppressWarnings("unchecked")
public Collection<? extends MessageBox> getAllMessages() {

    Query query = null;

    query = em.createQuery("FROM MessageBox m");

    return query.getResultList();
}

From source file:bankconsoleapp.repositories.CustomerDao.java

public List<Customer> getAllCust() {

    Query q = em.createQuery("FROM Customer as c LEFT JOIN FETCH c.savingAccounts");
    List<Customer> cust = q.getResultList();

    for (Customer c : cust) {
        if (c.getSavingAccounts().size() > 0) {
            c.setSA(c.getSavingAccounts().get(0).getAccNum());
        }/*  w ww .  j  av a2  s.  c o  m*/
    }

    return cust;

}

From source file:bankconsoleapp.repositories.SavingDao.java

public List<SavingAccount> getAllSA() {

    Query q = em.createQuery("FROM SavingAccount");
    List<SavingAccount> sa = q.getResultList();

    for (SavingAccount sav : sa) {

        System.out.println("Account Number: " + sav.getAccNum() + " Balance :" + sav.getBalance());
    }/*w ww. ja v  a 2s  .  c  o m*/

    return sa;

}

From source file:uk.ac.ebi.intact.editor.services.admin.HqlQueryService.java

@Transactional(value = "jamiTransactionManager", readOnly = true, propagation = Propagation.REQUIRED)
public List<? extends IntactPrimaryObject> runQuery(int maxResults, String hqlQuery) {
    maxResults = Math.min(maxResults, MAX_RESULTS);

    hqlQuery = cleanQuery(hqlQuery);/*  w w w .  j a v a2s .  c o  m*/

    EntityManager em = getIntactDao().getEntityManager();
    Query query = em.createQuery(hqlQuery);
    query.setMaxResults(maxResults);

    return query.getResultList();
}

From source file:com.bfds.saec.batch.file.domain.out.damasco_domestic.DomesticTaxRecHeaderCallback.java

private OutboundDomesticTaxRec getFirstRecord() {
    OutboundDomesticTaxRec rec = null;/* w  w  w  . ja  v a  2  s. com*/
    queryProvider.setEntityManager(entityManager);
    Query query = queryProvider.createQuery().setMaxResults(1);
    List<?> resultList = query.getResultList();
    if (resultList.size() > 0) {
        rec = (OutboundDomesticTaxRec) resultList.get(0);
    }
    return rec;

}

From source file:com.excilys.ebi.sample.jpa.query.benchmark.repository.impl.NamedQueryRepository.java

@Override
@SuppressWarnings("unchecked")
public List<Song> getSongsByArtistNameOrderBySongTitle(String name) {

    Query query = em.createNamedQuery("getSongsByArtistName");
    query.setParameter(1, name);/* w ww .j a v a 2  s.c o m*/

    return query.getResultList();
}