List of usage examples for javax.persistence Query setMaxResults
Query setMaxResults(int maxResult);
From source file:com.grummages.app.rest.entity.service.AddressRESTFacade.java
private List<Address> find(boolean all, int maxResults, int firstResult) { try {/*from w w w. j a v a 2s . co m*/ Query query = entityManager.createQuery("SELECT object(o) FROM Address AS o"); if (!all) { query.setMaxResults(maxResults); query.setFirstResult(firstResult); } return query.getResultList(); } finally { entityManager.close(); } }
From source file:com.grummages.app.rest.entity.service.ListingRESTFacade.java
private List<Listing> find(boolean all, int maxResults, int firstResult) { try {//from w ww . j ava 2s . co m Query query = entityManager.createQuery("SELECT object(o) FROM Listing AS o"); if (!all) { query.setMaxResults(maxResults); query.setFirstResult(firstResult); } return query.getResultList(); } finally { entityManager.close(); } }
From source file:com.grummages.app.rest.entity.service.PaymentRESTFacade.java
private List<Payment> find(boolean all, int maxResults, int firstResult) { try {/*w w w .j a va 2s . c o m*/ Query query = entityManager.createQuery("SELECT object(o) FROM Payment AS o"); if (!all) { query.setMaxResults(maxResults); query.setFirstResult(firstResult); } return query.getResultList(); } finally { entityManager.close(); } }
From source file:service.ItemRESTFacade.java
private List<Item> find(boolean all, int maxResults, int firstResult) { try {/*from www . j a v a 2s .c o m*/ Query query = entityManager.createQuery("SELECT object(o) FROM Item AS o"); if (!all) { query.setMaxResults(maxResults); query.setFirstResult(firstResult); } return query.getResultList(); } finally { entityManager.close(); } }
From source file:service.ResourceRESTFacade.java
private List<Resource> find(boolean all, int maxResults, int firstResult) { try {//from w w w . j a v a 2s . c o m Query query = entityManager.createQuery("SELECT object(o) FROM Resource AS o"); if (!all) { query.setMaxResults(maxResults); query.setFirstResult(firstResult); } return query.getResultList(); } finally { entityManager.close(); } }
From source file:de.inetsource.jsfforum.db.PostFacade.java
public List<Post> findRange(Thread thread, int[] rangeArray) { Query query = getEntityManager().createNamedQuery("Post.findByThreadId"); query.setParameter("id", thread.getId()); query.setFirstResult(rangeArray[0]); query.setMaxResults(rangeArray[1]); return query.getResultList(); }
From source file:com.grummages.app.rest.entity.service.CreditCardRESTFacade.java
private List<CreditCard> find(boolean all, int maxResults, int firstResult) { try {/*w w w . j a v a 2 s . c om*/ Query query = entityManager.createQuery("SELECT object(o) FROM CreditCard AS o"); if (!all) { query.setMaxResults(maxResults); query.setFirstResult(firstResult); } return query.getResultList(); } finally { entityManager.close(); } }
From source file:com.grummages.app.rest.entity.service.AuthoritiesRESTFacade.java
private List<Authorities> find(boolean all, int maxResults, int firstResult) { try {//from w w w . j av a 2 s . co m Query query = entityManager.createQuery("SELECT object(o) FROM Authorities AS o"); if (!all) { query.setMaxResults(maxResults); query.setFirstResult(firstResult); } return query.getResultList(); } finally { entityManager.close(); } }
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); q.setFirstResult(offset);// w ww . jav a 2s . c om return q.getResultList(); } }); }
From source file:com.sapito.db.dao.AbstractDao.java
public List<T> findRange(int[] range) { javax.persistence.criteria.CriteriaQuery cq = entityManager.getCriteriaBuilder().createQuery(); cq.select(cq.from(entityClass));//www . ja va2s.c o m javax.persistence.Query q = entityManager.createQuery(cq); q.setMaxResults(range[1] - range[0]); q.setFirstResult(range[0]); return q.getResultList(); }