List of usage examples for javax.persistence Query getResultList
List getResultList();
From source file:com.jd.survey.dao.security.UserDAOImpl.java
@SuppressWarnings("unchecked") @Transactional/*from www.j ava 2s . c o m*/ public Set<User> findAllInternal(int startResult, int maxRows) throws DataAccessException { Query query = createNamedQuery("User.findAllInternal", startResult, maxRows); return new LinkedHashSet<User>(query.getResultList()); }
From source file:com.jd.survey.dao.security.UserDAOImpl.java
@SuppressWarnings("unchecked") @Transactional/*from w w w . j a v a 2 s. c o m*/ public Set<User> findAllExternal(int startResult, int maxRows) throws DataAccessException { Query query = createNamedQuery("User.findAllExternal", startResult, maxRows); return new LinkedHashSet<User>(query.getResultList()); }
From source file:de.berlios.jhelpdesk.dao.jpa.TicketDAOJpa.java
public List<Ticket> getTicketsWithFilter(final TicketFilter ticketFilter, final int limit, final int offset) throws DAOException { return (List<Ticket>) this.jpaTemplate.execute(new JpaCallback() { public Object doInJpa(EntityManager em) throws PersistenceException { Query q = new QueryBuilder(ticketFilter, em).getFilteredQuery(false); q.setMaxResults(limit);//from ww w .j av a 2s .co m q.setFirstResult(offset); return q.getResultList(); } }); }
From source file:ea.ejb.PostFacade.java
public List<Post> findPostIdUsuarioOrder(BigDecimal id_usuario) { Query q; List<Post> listaPost;//from ww w . j a v a 2 s .c o m q = em.createQuery("SELECT p FROM Post p WHERE p.idUsuario.idUsuario=:ID ORDER BY p.idPost DESC"); q.setParameter("ID", id_usuario); listaPost = q.getResultList(); return listaPost; }
From source file:com.sixsq.slipstream.persistence.Run.java
@SuppressWarnings("unchecked") public static List<Run> listOldTransient(User user, int timeout) throws ConfigurationException, ValidationException { if (timeout <= 0) { timeout = DEFAULT_TIMEOUT; }/*from w ww .j a va 2 s .c o m*/ Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.MINUTE, -timeout); Date back = calendar.getTime(); EntityManager em = PersistenceUtil.createEntityManager(); Query q = createNamedQuery(em, "oldInStatesRuns"); q.setParameter("user", user.getName()); q.setParameter("before", back); q.setParameter("states", States.transition()); List<Run> runs = q.getResultList(); em.close(); return runs; }
From source file:eu.planets_project.tb.impl.persistency.CommentPersistencyImpl.java
public List<Comment> getComments(long experimentID, String experimentPhaseID) { Query query = manager.createQuery("from CommentImpl where experimentID=:expid and parentID=:parentid"); query.setParameter("expid", experimentID); query.setParameter("parentid", -1l); return (List<Comment>) query.getResultList(); }
From source file:com.gymadmin.persistence.dao.impl.PlanDaoImpl.java
public List<PlanEntity> findByFilters(Map<String, String> filters) { Query namedQuery = em.createNamedQuery("PlanEntity.findByFilters"); namedQuery.setParameter("name", "%" + filters.get("name").toUpperCase() + "%"); namedQuery.setParameter("description", "%" + filters.get("description").toUpperCase() + "%"); return (List<PlanEntity>) namedQuery.getResultList(); }
From source file:com.healthcit.cacure.dao.BaseJpaDaoTest.java
@SuppressWarnings("unchecked") @Test//from ww w .j a va 2s . co m public void testDelete() { String jpql = "from QuestionnaireForm frm where frm.id is not null"; Query query = em.createQuery(jpql); List<QuestionnaireForm> questionFroms = query.getResultList(); for (QuestionnaireForm questionnaireForm : questionFroms) { baseJpaDao.delete(questionnaireForm.getId()); } QuestionnaireForm actualQuestionnaireForm = baseJpaDao.getById(newlyInsertedId); Assert.assertNull(actualQuestionnaireForm); }
From source file:com.impetus.kwitter.service.TwitterService.java
@Override public List<Tweet> findTweetByBody(String tweetBody) { Query q = em.createQuery("select u.tweets.body from User u where u.tweets.body =:body"); q.setParameter("body", tweetBody); List<Tweet> tweets = q.getResultList(); return tweets; }
From source file:com.sct.descubriendoturuta.service.UsuarioServiceImpl.java
@Override @Transactional// w ww .j av a2 s . co m public List<Invitacion> obtenerUsuariosInvitados(int rutaId) { Query query = em.createQuery("select i from Invitacion i WHERE i.ruta.id = :p"); query.setParameter("p", rutaId); return query.getResultList(); }