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:ApplicationDao.CustomerDao.java

public List<Customer> getAllCustomer() {
    em.getTransaction().begin();/*w  w w  .  ja  v  a2  s . c om*/
    Query q = em.createNamedQuery("GetAllCustomers");
    List<Customer> lstCustomerInfo = (List<Customer>) q.getResultList();
    em.getTransaction().commit();
    return lstCustomerInfo;
}

From source file:org.opentides.dao.impl.SystemCodesDaoJpaImpl.java

/**
 * Returns all the available categories.
 * @return//  w w  w . ja  v a  2s  .c o  m
 */
@SuppressWarnings("unchecked")
public List<String> getAllCategories() {
    String queryString = getJpqlQuery("jpql.systemcodes.findAllCategories");
    Query queryObject = getEntityManager().createQuery(queryString);

    return queryObject.getResultList();
}

From source file:eu.planets_project.tb.impl.persistency.CommentPersistencyImpl.java

public List<Comment> getAllComments() {
    Query query = manager.createQuery("from CommentImpl");
    return (List<Comment>) query.getResultList();
}

From source file:com.tamnd2.basicwebapp.core.repositories.jpa.JpaBlogEntryRepo.java

@Override
public List<BlogEntry> findByBlogId(Long blogId) {
    Query query = em.createQuery("SELECT b FROM BlogEntry b WHERE b.blog.id=?1");
    query.setParameter(1, blogId);/*w w w  . j  a  v  a  2s. c o m*/
    return query.getResultList();
}

From source file:edu.mum.dao.impl.UserDaoImpl.java

@Override
public List<User> findAllExceptThisUserId(Integer id) {

    Query query = this.entityManager.createQuery("SELECT u FROM User u where u.id!=:id");

    query.setParameter("id", id);

    return query.getResultList();
}

From source file:pl.edu.uksw.j2eecourse.service.BookRentalServiceImpl.java

@Override
public List<User> listUsers() {
    Query q = entityManager.createQuery("Select u from User u");
    return q.getResultList();
}

From source file:pl.edu.uksw.j2eecourse.service.BookRentalServiceImpl.java

@Override
public List<Book> listBooks() {
    Query q = entityManager.createQuery("Select b from Book b");
    return q.getResultList();
}

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

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

    Query query = em.createQuery("from Song where artist.name=? order by title");
    query.setParameter(1, name);/*  w w w  .j  ava  2  s  .c o  m*/

    return query.getResultList();
}

From source file:com.tamnd2.basicwebapp.core.repositories.jpa.JpaBlogRepo.java

@Override
public List<Blog> findBlogsByAccount(Long accountId) {
    Query query = em.createQuery("SELECT b from Blog b where b.owner.id=?1");
    query.setParameter(1, accountId);/* ww  w . j a  v a 2s  .co  m*/
    return query.getResultList();
}

From source file:de.inetsource.jsfforum.db.PostFacade.java

public List<Post> findPostsFromTopic(Integer threadId) {
    Query query = getEntityManager().createNamedQuery("Post.findByThreadId");
    query.setParameter("id", threadId);
    return query.getResultList();
}