List of usage examples for javax.persistence TypedQuery getResultList
List<X> getResultList();
From source file:org.openmeetings.app.data.basic.dao.OmTimeZoneDaoImpl.java
public OmTimeZone getOmTimeZone(String jname) { try {//from www. j a v a 2s . c o m String hql = "select sl from OmTimeZone as sl " + "WHERE sl.jname LIKE :jname " + "OR sl.ical LIKE :jname"; TypedQuery<OmTimeZone> query = em.createQuery(hql, OmTimeZone.class); query.setParameter("jname", jname); List<OmTimeZone> sList = query.getResultList(); if (sList.size() > 0) { return sList.get(0); } } catch (Exception ex2) { log.error("[getOmTimeZone]: ", ex2); } return null; }
From source file:example.springdata.jpa.showcase.before.CustomerServiceImpl.java
@Override public List<Customer> findAll(int page, int pageSize) { TypedQuery<Customer> query = em.createQuery("select c from Customer c", Customer.class); query.setFirstResult(page * pageSize); query.setMaxResults(pageSize);/* ww w . j a v a2 s . com*/ return query.getResultList(); }
From source file:edu.sabanciuniv.sentilab.sare.controllers.entitymanagers.PersistentDocumentStoreController.java
/** * Gets the size of a document store (number of documents contained therein). * @param em the {@link EntityManager} to use. * @param store the {@link PersistentDocumentStore} whose size is desired. * @return the {@link Long} count of documents. *//*from w ww . j a v a 2 s .c o m*/ public long getSize(EntityManager em, PersistentDocumentStore store) { Validate.notNull(em, CannedMessages.NULL_ARGUMENT, "em"); Validate.notNull(store, CannedMessages.NULL_ARGUMENT, "store"); TypedQuery<byte[]> query = em .createQuery("SELECT doc.id FROM PersistentDocument doc " + "WHERE doc.store=:store", byte[].class); query.setParameter("store", store); return query.getResultList().size(); }
From source file:com.ewcms.content.particular.dao.FrontEmployeArticleDAO.java
public List<EmployeArticle> findEmployeArticleBySector(Long organId) { String hql = "From EmployeArticle As p where p.organ.id=:organId and p.release=true Order By p.published desc "; TypedQuery<EmployeArticle> query = this.getEntityManager().createQuery(hql, EmployeArticle.class); query.setParameter("organId", Integer.valueOf(organId.toString())); return query.getResultList(); }
From source file:com.siriusit.spezg.multilib.storage.jpa.JpaUnitRepository.java
@Override public List<? extends Unit> findUnitsByOwner(Person owner) { TypedQuery<UnitDomainObject> query = entityManager.createNamedQuery("findUnitsByOwner", UnitDomainObject.class); query.setParameter("owner", owner); return query.getResultList(); }
From source file:com.siriusit.spezg.multilib.storage.jpa.JpaUnitRepository.java
@Override public List<? extends Unit> findUnitsByTitle(String title) { TypedQuery<UnitDomainObject> query = entityManager.createNamedQuery("findUnitsByTitle", UnitDomainObject.class); query.setParameter("title", title); return query.getResultList(); }
From source file:io.github.todolist.core.repository.impl.TodoRepositoryImpl.java
/** * {@inheritDoc}/*from w w w . j a v a2 s. c om*/ */ public List<Todo> getTodoListByUserAndTitle(final long userId, final String title) { TypedQuery<Todo> query = entityManager.createNamedQuery("findTodosByTitle", Todo.class); query.setParameter(1, userId); query.setParameter(2, "%" + title.toUpperCase() + "%"); return query.getResultList(); }
From source file:net.shopxx.dao.impl.ArticleCategoryDaoImpl.java
public List<ArticleCategory> findRoots(Integer count) { String jpql = "select articleCategory from ArticleCategory articleCategory where articleCategory.parent is null order by articleCategory.order asc"; TypedQuery<ArticleCategory> query = entityManager.createQuery(jpql, ArticleCategory.class); if (count != null) { query.setMaxResults(count);//from ww w . jav a2 s . co m } return query.getResultList(); }
From source file:net.shopxx.dao.impl.ProductCategoryDaoImpl.java
public List<ProductCategory> findRoots(Integer count) { String jpql = "select productCategory from ProductCategory productCategory where productCategory.parent is null order by productCategory.order asc"; TypedQuery<ProductCategory> query = entityManager.createQuery(jpql, ProductCategory.class); if (count != null) { query.setMaxResults(count);// w w w . ja v a 2 s .c om } return query.getResultList(); }
From source file:com.pingdu.dao.licenseDao.LicType_entTypeDao.java
public List<LicType_entType> getLicType_entTypeList(int page, int rows) { int head = (page - 1) * rows; String jpql = "select l from LicType_entType l where 1=1 "; TypedQuery<LicType_entType> query = em().createQuery(jpql, LicType_entType.class); //query.setHint(QueryHints.RESULT_TYPE, ResultType.Map); query.setFirstResult(head);//from w ww .j ava2 s .co m query.setMaxResults(rows); List<LicType_entType> list = query.getResultList(); return list; }