List of usage examples for javax.persistence Query getResultList
List getResultList();
From source file:com.impetus.kwitter.service.TwitterService.java
@Override public List<Tweet> findTweetByDevice(String deviceName) { Query q = em.createQuery("select u.tweets.device from User u where u.tweets.device =:device"); q.setParameter("device", deviceName); List<Tweet> tweets = q.getResultList(); return tweets; }
From source file:net.chrissearle.flickrvote.dao.JpaChallengeDao.java
/** * Method getClosedChallenges returns all challenges in a closed state. * * @return all closed challenges./*from w w w .j a va2s . c o m*/ */ @SuppressWarnings("unchecked") public List<Challenge> getClosedChallenges() { Query query = entityManager.createQuery("select c from Challenge c where c.endDate < :now"); query.setParameter("now", new Date()); return (List<Challenge>) query.getResultList(); }
From source file:org.messic.server.datamodel.jpaimpl.DAOJPAAuthor.java
@Override @Transactional/*ww w .j av a2 s . co m*/ public List<MDOAuthor> getAllDLNA() { Query query = entityManager .createQuery("from MDOAuthor as a where (a.owner.allowDLNA = true) ORDER BY UPPER(a.name)"); @SuppressWarnings("unchecked") List<MDOAuthor> results = query.getResultList(); return results; }
From source file:org.messic.server.datamodel.jpaimpl.DAOJPASong.java
@Override @Transactional/*www.j ava 2 s. com*/ public List<MDOSong> getAllDLNA() { Query query = entityManager.createQuery("from MDOSong as a where (a.owner.allowDLNA= true)"); @SuppressWarnings("unchecked") List<MDOSong> results = query.getResultList(); return results; }
From source file:eu.xipi.bro4xipi.brokermodel.BrokerJpaController.java
@SuppressWarnings("unchecked") public List<Broker> read(int firstResult, int maxResults) { Query q = entityManager.createQuery("SELECT m FROM Broker m"); q.setFirstResult(firstResult);/* w w w .j av a 2 s . c om*/ q.setMaxResults(maxResults); return q.getResultList(); }
From source file:org.syncope.core.persistence.dao.impl.TaskDAOImpl.java
@Override public List<PropagationTask> findAll(final ExternalResource resource, final SyncopeUser user) { StringBuilder queryString = buildfindAllQuery(PropagationTask.class); queryString.append("WHERE e.syncopeUser=:user ").append("AND e.resource=:resource"); final Query query = entityManager.createQuery(queryString.toString()); query.setParameter("user", user); query.setParameter("resource", resource); return query.getResultList(); }
From source file:edu.co.sena.proyecto.pruebasu.TestUsuario.java
@Test public void usuarioFindAll() { Query query = em.createNamedQuery("usuario.findALl", Usuario.class); List<Usuario> list = query.getResultList(); for (Usuario u : list) { System.out.println("..............................................."); System.out.println("Contrasena : " + u.getContrasena()); System.out.println("Correo Electronico : " + u.getCorreoElectronico()); System.out.println("Roll : " + u.getRoll()); System.out.println("Usuario - No. Documento : " + u.getCuenta().getCuentaPK().getNumeroDocumento()); System.out.println("Usuario - Tip. Documento :" + u.getCuenta().getCuentaPK().getTipoDocumento()); System.out.println("Estado : " + u.getEstado()); System.out.println("..............................................."); }/*from ww w . jav a 2 s. co m*/ }
From source file:com.dhenton9000.birt.jpa.service.impl.security.GroupsServiceImpl.java
@Override public List<Groups> findGroupsContainsApplication(Integer appId) { String qString = "select groups " + " from Groups groups " + " join groups.applicationsSet applications " + " where applications.id = :id "; Query q = this.entityManager.createQuery(qString); q.setParameter("id", appId); return q.getResultList(); }
From source file:com.grummages.app.rest.entity.service.AddonRESTFacade.java
private List<Addon> find(boolean all, int maxResults, int firstResult) { try {// w w w. j av a 2 s .c om Query query = entityManager.createQuery("SELECT object(o) FROM Addon AS o"); if (!all) { query.setMaxResults(maxResults); query.setFirstResult(firstResult); } return query.getResultList(); } finally { entityManager.close(); } }
From source file:com.gymadmin.persistence.dao.impl.PaymentMethodDaoImpl.java
@SuppressWarnings("unchecked") public List<PaymentPlanEntity> findByFilters(Map<String, String> filters) { Query namedQuery = em.createNamedQuery("PaymentMethodEntity.findByFilters"); namedQuery.setParameter("name", "%" + filters.get("name").toUpperCase() + "%"); namedQuery.setParameter("description", "%" + filters.get("description").toUpperCase() + "%"); return (List<PaymentPlanEntity>) namedQuery.getResultList(); }