List of usage examples for javax.persistence TypedQuery getResultList
List<X> getResultList();
From source file:com.fantasy.stataggregator.entities.dao.AbstractRepository.java
public List<T> getCriteriaList(CriteriaQuery<T> cq) { TypedQuery<T> query = em.createQuery(cq); return query.getResultList(); }
From source file:bq.jpa.demo.many2many.service.Many2ManyService.java
@Transactional public List<Project> findProjects() { TypedQuery<Project> query = em.createQuery("from jpa_many2many_project", Project.class); return query.getResultList(); }
From source file:com.pingdu.dao.licenseDao.LicType_entTypeDao.java
public Integer sum(int rows) { String jpql = "select lic_ent from LicType_entType lic_ent where 1=1"; TypedQuery<LicType_entType> query = em().createQuery(jpql, LicType_entType.class); //query.setHint(QueryHints.RESULT_TYPE, ResultType.Map);; int SUM = ((query.getResultList().size()) - 1) / rows + 1; return SUM;//from w w w . j a v a2s. c o m }
From source file:org.ualerts.fixed.repository.JpaPositionHintRepository.java
/** * {@inheritDoc}//from w w w . j ava 2 s.co m */ @Override public List<PositionHint> findAllHints() { TypedQuery<PositionHint> query = getEntityManager().createNamedQuery("findAllPositionHints", PositionHint.class); return query.getResultList(); }
From source file:com.deltastar.task7.core.repository.api.impl.TransitionRepositoryImpl.java
@Override public List<Transition> getTransitionList() { TypedQuery<Transition> query = entityManager.createNamedQuery("findAllTransition", Transition.class); return query.getResultList(); }
From source file:aka.pirana.jdoc.JChart.java
private XYDataset SampleGenerator() { manager.getTransaction().begin();//from ww w. j av a 2s. c om CriteriaBuilder cb = manager.getCriteriaBuilder(); CriteriaQuery<Consultation> query = cb.createQuery(Consultation.class); Root<Consultation> sm = query.from(Consultation.class); query.where(cb.equal(sm.get("patient.id"), id.toString())); TypedQuery<Consultation> q = manager.createQuery(query); List<Consultation> results = q.getResultList(); XYSeries xyWeightSeries = new XYSeries("Weight"); XYSeries xyFatSeries = new XYSeries("Fat"); XYSeries xyMuscleSeries = new XYSeries("Muscle"); XYSeries xyWaterSeries = new XYSeries("Water"); int i = 2; results.stream().map((result) -> { xyWeightSeries.add(i, result.getC_weight()); return result; }).map((result) -> { xyFatSeries.add(i, result.getC_gm()); return result; }).map((result) -> { xyMuscleSeries.add(i, result.getC_mm()); return result; }).forEach((result) -> { xyWaterSeries.add(i, result.getC_hm()); }); XYSeriesCollection xyseriescollection = new XYSeriesCollection(xyWeightSeries); xyseriescollection.addSeries(xyFatSeries); xyseriescollection.addSeries(xyMuscleSeries); xyseriescollection.addSeries(xyWaterSeries); return xyseriescollection; }
From source file:com.googlecode.osgienterprise.geminitx.library.service.PersistentLibraryService.java
public List<Book> findBooksByTitle(String title) { String jpql = "select b from Book b where b.title = :title"; TypedQuery<Book> query = em.createQuery(jpql, Book.class); query.setParameter("title", title); List<Book> books = query.getResultList(); return books; }
From source file:com.sshdemo.common.report.manage.dao.TextReportDAO.java
public List<CategoryReport> findCategoryReportByTextReportId(final Long textReportId) { String hql = "Select c From CategoryReport As c Left Join c.texts As t Where t.id=:textReportId"; TypedQuery<CategoryReport> query = this.getEntityManager().createQuery(hql, CategoryReport.class); query.setParameter("textReportId", textReportId); return query.getResultList(); }
From source file:com.sshdemo.common.report.manage.dao.TextReportDAO.java
public List<EwcmsJobReport> findEwcmsJobReportByTextReportId(final Long textReportId) { String hql = "Select e From EwcmsJobReport As e Where e.textReport.id=:textReportId"; TypedQuery<EwcmsJobReport> query = this.getEntityManager().createQuery(hql, EwcmsJobReport.class); query.setParameter("textReportId", textReportId); return query.getResultList(); }
From source file:bq.jpa.demo.many2many.service.Many2ManyService.java
/** * default is lazy-load, so we cannot get project information from the result employees * return from this method, because it's out of the session after the method is over. * to solve this problem, set fetch=FetchType.EAGER. * @return//from w w w.ja va2 s . co m */ @Transactional public List<Employee> findEmployees() { TypedQuery<Employee> query = em.createQuery("FROM jpa_many2many_employee", Employee.class); return query.getResultList(); }