List of usage examples for javax.persistence Query getResultList
List getResultList();
From source file:com.nandhootoo.services.UserServiceImpl.java
public List getUsersWithCriteria(String criteria) { try {//from w w w .j av a 2 s . c o m Query aQuery = entityManager.createQuery("select user from User as user " + criteria); return aQuery.getResultList(); } catch (Exception sqlex) { System.out.println("SQL Exception: " + sqlex.getMessage()); return null; } }
From source file:org.simbasecurity.core.config.store.DatabaseConfigurationStore.java
@SuppressWarnings("unchecked") public List<String> getValueList(ConfigurationParameter parameter) { Query query = entityManager.createNativeQuery(SQL_GET); query.setParameter(1, String.valueOf(parameter)); return query.getResultList(); }
From source file:com.expressui.sample.dao.UserDao.java
@Override public List<User> findAll() { Query query = getEntityManager().createQuery("SELECT u FROM User u ORDER BY u.loginName"); setReadOnly(query);//from www .ja v a 2s . co m return query.getResultList(); }
From source file:fr.norad.visuwall.core.persistence.dao.WallDAOImpl.java
@Override @SuppressWarnings("unchecked") public List<Wall> getWalls() { Query query = entityManager.createNamedQuery(Wall.QUERY_WALLS); List<Wall> resultList = query.getResultList(); for (Wall wall : resultList) { // TODO replace with lazy load with extended entityManager or eager request for (SoftwareAccess softwareInfo : wall.getSoftwareAccesses()) { List<SoftwareProjectId> projectNames = softwareInfo.getProjectIds(); for (SoftwareProjectId softwareProjectId : projectNames) { }//from ww w . j a v a2 s. co m List<String> projectViews = softwareInfo.getViewNames(); for (String string : projectViews) { } Map<String, String> properties = softwareInfo.getProperties(); for (String string : properties.keySet()) { } } } return resultList; }
From source file:org.waastad.enumjparest.service.RatingServiceIT.java
@Test public void test_03_correct_insert() throws Exception { System.out.println("test_03_correct_insert"); String json = String.format("{\"name\":\"%s\",\"rating\":%d}", MOVIE, Rating.UNRATED.getValue()); System.out.println("Sending josn: " + json); RestAssured.baseURI = "http://127.0.0.1:4204/TomeeEnumRest/rest"; com.jayway.restassured.response.Response r = RestAssured.given().contentType("application/json").body(json) .when().post();//from w w w .j a v a2 s .co m Query q = em.createQuery("SELECT t FROM Movie t"); List resultList = q.getResultList(); Assert.assertEquals(1, resultList.size()); q = em.createQuery("SELECT t FROM Movie t WHERE t.rating=:rating").setParameter("rating", Rating.UNRATED); List resultList1 = q.getResultList(); Assert.assertEquals(1, resultList1.size()); }
From source file:bc8.movies.dao.MovieDaoImpl.java
public boolean isMovieInDB(String movieName) { Query query = em.createQuery("select movie from Movie movie where movie.name= :movieName"); query.setParameter("movieName", movieName); return !query.getResultList().isEmpty(); }
From source file:com.fusesource.examples.persistence.part2.dao.impl.IncidentDAOImpl.java
public List<Incident> findIncident(String key) { Query q = this.em.createQuery("select i from Incident as i where i.incidentRef = :ref"); q.setParameter("ref", key); List list = q.getResultList(); return list;//from w ww.j a v a2s. co m }
From source file:com.nandhootoo.services.IssueServiceImpl.java
public List getIssuesWithCriteria(String criteria) { try {/*from www. j a v a 2s . c o m*/ Query aQuery = entityManager.createQuery("select issue from Issue as issue " + criteria); return aQuery.getResultList(); } catch (Exception sqlex) { System.out.println("SQL Exception: " + sqlex.getMessage()); return null; } }
From source file:cz.fi.muni.pa036.airticketbooking.dao.impl.SeatDaoImpl.java
@Override public List<Seat> getAll() { try {//from ww w . j a v a 2 s . c om Query q = em.createQuery("FROM Seat"); List<Seat> planes = q.getResultList(); return Collections.unmodifiableList(planes); } catch (PersistenceException | IllegalArgumentException ex) { throw new DataAccessException(ex.getMessage(), ex) { }; } }
From source file:Professor.java
public Collection<Professor> findAllProfessors() { Query query = em.createQuery("SELECT e FROM Professor e"); return (Collection<Professor>) query.getResultList(); }