List of usage examples for javax.persistence Query getResultList
List getResultList();
From source file:modelo.dao.GestionProductosImpl.java
@Override public List<Producto> obtenerProductos(int user, int color) { Query q = em.createNamedQuery("Producto.findByUserColor"); q.setParameter(1, user);/*w ww. j av a 2 s . c o m*/ q.setParameter(2, color); return q.getResultList(); }
From source file:almira.sample.dao.CatapultDaoHibernateSearch.java
@Override @SuppressWarnings("unchecked") public List<Catapult> searchByName(final String searchQuery, final int startIndex, final int fetchSize) throws ParseException { Query query = createQuery(searchQuery); query.setFirstResult(startIndex).setMaxResults(fetchSize); return query.getResultList(); }
From source file:com.expressui.sample.dao.PermissionDao.java
@Override public List<Permission> findAll() { Query query = getEntityManager().createQuery("SELECT p FROM Permission p ORDER BY p.entityType, p.field"); setReadOnly(query);/* w w w . jav a2s . co m*/ return query.getResultList(); }
From source file:pdsanchez.mywebtools.model.dao.jpa.CategoryDAOJPAImpl.java
@Override public Category find(String name) { Category c = null;/*from www . j a v a2 s.c o m*/ Query q = getEntityManager().createQuery("select o from Category o where lower(o.categoryName) = :name"); q.setParameter("name", name.toLowerCase()); List<Category> list = q.getResultList(); if (!list.isEmpty()) { c = list.get(0); } return c; }
From source file:ro.alexdutescu.coduribare.service.AbstractFacade.java
public List<T> findRange(int[] range) { javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery(); cq.select(cq.from(entityClass));//from w w w . j a va2 s. c o m javax.persistence.Query q = getEntityManager().createQuery(cq); q.setMaxResults(range[1] - range[0] + 1); q.setFirstResult(range[0]); return q.getResultList(); }
From source file:at.irian.demo.jsfatwork.repository.jpa.JpaGroupRepository.java
public List<Group> loadUnSubscribedGroups(User user) { Query query = this.entityManager.createNamedQuery(DomainQueryDetails.FIND_UNSUBSCRIBED_GROUPS); query.setParameter(DomainQueryDetails.PARAMETER_USER, user); return query.getResultList(); }
From source file:com.nandhootoo.services.DepartmentServiceImpl.java
public List getDepartmentsWithCriteria(String criteria) { try {/*from ww w. ja v a2 s .c o m*/ Query aQuery = entityManager.createQuery("select department from Department as department " + criteria); return aQuery.getResultList(); } catch (Exception sqlex) { System.out.println("SQL Exception: " + sqlex.getMessage()); return null; } }
From source file:com.impetus.client.oraclenosql.OracleNoSQLTestBase.java
protected List executeSelectQuery(String jpaQuery, Map<Object, Object> params) { Query query = em.createQuery(jpaQuery); setParams(params, query);//from ww w. j a va2s .c o m return query.getResultList(); }
From source file:com.brienwheeler.svc.ledger.impl.LedgerEntryDao.java
@Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) @SuppressWarnings("unchecked") public List<LedgerEntry> getLedger(long userId) { Query query = entityManager.createQuery("from LedgerEntry where user_id = :userId order by timestamp"); query.setParameter("userId", userId); return (List<LedgerEntry>) query.getResultList(); }
From source file:com.expressui.sample.dao.PermissionDao.java
public List<Permission> findByRole(Role role) { Query query = getEntityManager().createQuery("SELECT p FROM Permission p WHERE p.role = :role"); query.setParameter("role", role); return query.getResultList(); }