List of usage examples for javax.persistence TypedQuery getResultList
List<X> getResultList();
From source file:net.triptech.metahive.model.Record.java
/** * Find the record going by the supplied record id. * * @param recordId the recordId//from www . java 2 s.c om * @return the record */ public static Record findRecordByRecordIdEquals(String recordId) { Record record = null; if (StringUtils.isBlank(recordId)) { throw new IllegalArgumentException("The recordId argument is required"); } TypedQuery<Record> q = entityManager() .createQuery("SELECT r FROM Record AS r WHERE LOWER(r.recordId) = LOWER(:recordId)", Record.class); q.setParameter("recordId", recordId); List<Record> records = q.getResultList(); if (records != null && records.size() > 0) { record = records.get(0); } return record; }
From source file:org.jasig.portlet.blackboardvcportlet.dao.impl.PresentationDaoImpl.java
@Override public Set<Presentation> getAllPresentations() { final TypedQuery<PresentationImpl> query = this.createQuery(this.findAllPresentation); return new LinkedHashSet<Presentation>(query.getResultList()); }
From source file:org.mitre.uma.repository.impl.JpaResourceSetRepository.java
@Override public Collection<ResourceSet> getAllForOwner(String owner) { TypedQuery<ResourceSet> query = em.createNamedQuery(ResourceSet.QUERY_BY_OWNER, ResourceSet.class); query.setParameter(ResourceSet.PARAM_OWNER, owner); return query.getResultList(); }
From source file:fr.univrouen.poste.web.ForgotPasswordController.java
@RequestMapping(value = "/forgotpassword/change", method = RequestMethod.POST) public String modifyPasswordWithActivationKey( @ModelAttribute("changePasswordForm") ForgotChangePasswordForm form, BindingResult result, HttpServletRequest request) {//w w w . j a v a 2 s .c o m validator.validate(form, result); if (result.hasErrors()) { return "changepassword/index"; // back to form } TypedQuery<User> userQuery = User.findUsersByActivationKey(form.getActivationKey()); if (null != userQuery && !userQuery.getResultList().isEmpty()) { User user = userQuery.getSingleResult(); user.setPassword(messageDigestPasswordEncoder.encodePassword(form.getNewPassword(), null)); user.setActivationKey(null); user.merge(); } return "redirect:/"; }
From source file:com.deltastar.task7.core.repository.api.impl.PositionRepositoryImpl.java
@Override public List<Position> getPositionListByCustomerId(int customerId) { TypedQuery<Position> query = entityManager.createNamedQuery("findPositionByCustomerId", Position.class); query.setParameter("p_customerId", customerId); return query.getResultList(); }
From source file:com.ewcms.content.particular.dao.FrontEnterpriseArticleDAO.java
public List<EnterpriseArticle> findEnterpriseArticleByCode(String code) { String hql = "From EnterpriseArticle As p where p.enterpriseBasic.yyzzzch=:code and p.release=true Order By p.published desc "; TypedQuery<EnterpriseArticle> query = this.getEntityManager().createQuery(hql, EnterpriseArticle.class); query.setParameter("code", code); return query.getResultList(); }
From source file:com.plan.proyecto.repositorios.DaoCuentaImpl.java
@Override public Cuenta findByEmail(String email) { TypedQuery<Cuenta> query = em.createNamedQuery("Cuenta.findByEmail", Cuenta.class); query.setParameter("valor", email); List<Cuenta> lista = query.getResultList(); if (lista.isEmpty()) { return null; }// www .j a va 2 s . c o m return lista.get(0); }
From source file:com.plan.proyecto.repositorios.DaoCuentaImpl.java
@Override public List<Cuenta> findByNombre(String nombre) { TypedQuery<Cuenta> query = em.createNamedQuery("Cuenta.findByNombre", Cuenta.class); query.setParameter("valor", nombre); List<Cuenta> results = query.getResultList(); return results; }
From source file:com.deltastar.task7.core.repository.api.impl.FundRepositoryImpl.java
@Override public Fund getFundByName(String fundName) { TypedQuery<Fund> query = entityManager.createNamedQuery("findFundByFundName", Fund.class); query.setParameter("p_fundName", fundName); List<Fund> fundList = query.getResultList(); return (fundList != null && !fundList.isEmpty()) ? fundList.get(0) : null; }
From source file:com.plan.proyecto.repositorios.DaoContenidoImpl.java
@Override public List<Comentario> findComentarioByCuenta(Cuenta cuenta) { if (cuenta == null) { return null; }//from w w w . j av a 2 s . c om TypedQuery<Comentario> query = em.createNamedQuery("Comentario.findComentarioByCuenta", Comentario.class); query.setParameter("idValor", cuenta.getId()); return query.getResultList(); }